Class: Gem::Resolver::Molinillo::DependencyGraph::Vertex
Relationships & Source Files | |
Inherits: | Object |
Defined in: | lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph.rb |
Overview
A vertex in a ::Gem::Resolver::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
- #incoming_edges ⇒ Array<Edge> rw
- #name ⇒ String rw
- #outgoing_edges ⇒ Array<Edge> rw
- #payload ⇒ Object rw
-
#root?
rw
Alias for #root.
- #explicit_requirements ⇒ Arrary<Object> readonly
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 ⇒ Array<Vertex>
- #recursive_successors ⇒ Array<Vertex>
- #requirements ⇒ Array<Object>
- #root ⇒ Boolean (also: #root?) rw
- #shallow_eql?(other) ⇒ Boolean
- #successors ⇒ Array<Vertex>
Constructor Details
.new(name, payload) ⇒ Vertex
Initializes a vertex with the given name and payload.
Instance Attribute Details
#explicit_requirements ⇒ Arrary
<Object
> (readonly)
# File 'lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph.rb', line 179
attr_reader :explicit_requirements
#incoming_edges ⇒ Array
<Edge> (rw)
# File 'lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph.rb', line 208
attr_accessor :incoming_edges
#name ⇒ String
(rw)
# File 'lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph.rb', line 172
attr_accessor :name
#outgoing_edges ⇒ Array
<Edge> (rw)
# File 'lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph.rb', line 204
attr_accessor :outgoing_edges
#payload ⇒ Object
(rw)
# File 'lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph.rb', line 175
attr_accessor :payload
#root? (rw)
Alias for #root.
# File 'lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph.rb', line 183
alias_method :root?, :root
Instance Method Details
#==(other) ⇒ Boolean
Also known as: #eql?
# File 'lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph.rb', line 247
def ==(other) shallow_eql?(other) && successors.to_set == other.successors.to_set end
#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/rubygems/resolver/molinillo/lib/molinillo/dependency_graph.rb', line 280
def ancestor?(other) other.path_to?(self) end
#descendent?(other)
Alias for #path_to?.
# File 'lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph.rb', line 275
alias_method :descendent?, :path_to?
#eql?(other)
Alias for #==.
# File 'lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph.rb', line 261
alias_method :eql?, :==
#hash ⇒ Fixnum
# File 'lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph.rb', line 264
def hash name.hash end
#inspect ⇒ String
#is_reachable_from?(other)
Alias for #ancestor?.
# File 'lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph.rb', line 284
alias_method :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/rubygems/resolver/molinillo/lib/molinillo/dependency_graph.rb', line 271
def path_to?(other) equal?(other) || successors.any? { |v| v.path_to?(other) } end
#predecessors ⇒ Array
<Vertex
>
# File 'lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph.rb', line 212
def predecessors incoming_edges.map(&:origin) end
#recursive_predecessors ⇒ Array
<Vertex
>
#recursive_successors ⇒ Array
<Vertex
>
#requirements ⇒ Array
<Object
>
# File 'lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph.rb', line 198
def requirements incoming_edges.map(&:requirement) + explicit_requirements end
#root ⇒ Boolean
(rw)
Also known as: #root?
# File 'lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph.rb', line 182
attr_accessor :root
#shallow_eql?(other) ⇒ Boolean
#successors ⇒ Array
<Vertex
>
# File 'lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph.rb', line 227
def successors outgoing_edges.map(&:destination) end