Class: Bundler::Molinillo::DependencyGraph::Vertex
Relationships & Source Files | |
Inherits: | Object |
Defined in: | lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb |
Overview
A vertex in a ::Bundler::Molinillo::DependencyGraph
that encapsulates a #name and a #payload
Class Method Summary
-
.new(name, payload) ⇒ Vertex
constructor
Initializes a vertex with the given name and payload.
Instance Attribute Summary
- #explicit_requirements ⇒ Array<Object> readonly
- #incoming_edges ⇒ Array<Edge> rw
- #name ⇒ String rw
- #outgoing_edges ⇒ Array<Edge> rw
- #payload ⇒ Object rw
-
#root?
rw
Alias for #root.
Instance Method Summary
- #==(other) ⇒ Boolean (also: #eql?)
-
#ancestor?(other) ⇒ Boolean
(also: #is_reachable_from?)
Is there a path from
other
toself
following edges in the dependency graph? -
#descendent?(other)
Alias for #path_to?.
-
#eql?(other)
Alias for #==.
- #hash ⇒ Fixnum
- #inspect ⇒ String
-
#is_reachable_from?(other)
Alias for #ancestor?.
-
#path_to?(other) ⇒ Boolean
(also: #descendent?)
Is there a path from
self
toother
following edges in the dependency graph? - #predecessors ⇒ Array<Vertex>
- #recursive_predecessors ⇒ Set<Vertex>
- #recursive_successors ⇒ Set<Vertex>
- #requirements ⇒ Array<Object>
- #root ⇒ Boolean (also: #root?) rw
- #shallow_eql?(other) ⇒ Boolean
- #successors ⇒ Array<Vertex>
- #_path_to?(other, visited = Set.new) ⇒ Boolean protected
- #_recursive_predecessors(vertices = Set.new) ⇒ Set<Vertex> protected
- #_recursive_successors(vertices = Set.new) ⇒ Set<Vertex> protected
Constructor Details
.new(name, payload) ⇒ Vertex
Initializes a vertex with the given name and payload.
Instance Attribute Details
#explicit_requirements ⇒ Array
<Object
> (readonly)
# File 'lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb', line 16
attr_reader :explicit_requirements
#incoming_edges ⇒ Array
<Edge> (rw)
# File 'lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb', line 45
attr_accessor :incoming_edges
#name ⇒ String
(rw)
# File 'lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb', line 9
attr_accessor :name
#outgoing_edges ⇒ Array
<Edge> (rw)
# File 'lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb', line 41
attr_accessor :outgoing_edges
#payload ⇒ Object
(rw)
# File 'lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb', line 12
attr_accessor :payload
#root? (rw)
Alias for #root.
# File 'lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb', line 20
alias root? root
Instance Method Details
#==(other) ⇒ Boolean
Also known as: #eql?
# File 'lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb', line 106
def ==(other) return true if equal?(other) shallow_eql?(other) && successors.to_set == other.successors.to_set end
#_path_to?(other, visited = Set.new) ⇒ Boolean
(protected)
# File 'lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb', line 141
def _path_to?(other, visited = Set.new) return false unless visited.add?(self) return true if equal?(other) successors.any? { |v| v._path_to?(other, visited) } end
#_recursive_predecessors(vertices = Set.new) ⇒ Set
<Vertex
> (protected)
#_recursive_successors(vertices = Set.new) ⇒ Set
<Vertex
> (protected)
#ancestor?(other) ⇒ Boolean
Also known as: #is_reachable_from?
Is there a path from other
to self
following edges in the dependency graph?
# File 'lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb', line 151
def ancestor?(other) other.path_to?(self) end
#descendent?(other)
Alias for #path_to?.
# File 'lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb', line 136
alias descendent? path_to?
#eql?(other)
Alias for #==.
# File 'lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb', line 122
alias eql? ==
#hash ⇒ Fixnum
# File 'lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb', line 125
def hash name.hash end
#inspect ⇒ String
#is_reachable_from?(other)
Alias for #ancestor?.
# File 'lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb', line 155
alias is_reachable_from? ancestor?
#path_to?(other) ⇒ Boolean
Also known as: #descendent?
Is there a path from self
to other
following edges in the dependency graph?
# File 'lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb', line 132
def path_to?(other) _path_to?(other) end
#predecessors ⇒ Array
<Vertex
>
# File 'lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb', line 49
def predecessors incoming_edges.map(&:origin) end
#recursive_predecessors ⇒ Set
<Vertex
>
# File 'lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb', line 55
def recursive_predecessors _recursive_predecessors end
#recursive_successors ⇒ Set
<Vertex
>
# File 'lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb', line 81
def recursive_successors _recursive_successors end
#requirements ⇒ Array
<Object
>
# File 'lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb', line 35
def requirements (incoming_edges.map(&:requirement) + explicit_requirements).uniq end
#root ⇒ Boolean
(rw)
Also known as: #root?
# File 'lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb', line 19
attr_accessor :root
#shallow_eql?(other) ⇒ Boolean
#successors ⇒ Array
<Vertex
>
# File 'lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb', line 75
def successors outgoing_edges.map(&:destination) end