Class: Gem::Resolver::Molinillo::DependencyGraph::AddVertex
Do not use. This class is for internal use only.
Relationships & Source Files | |
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
self,
Action
|
|
Instance Chain:
self,
Action
|
|
Inherits: |
Gem::Resolver::Molinillo::DependencyGraph::Action
|
Defined in: | lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/add_vertex.rb |
Overview
(see #add_vertex)
Action
- .action_name ⇒ Symbol
-
#down(graph) ⇒ Void
Reverses the action on the given graph.
-
#up(graph) ⇒ Void
Performs the action on the given graph.
AddVertex
- #name ⇒ String readonly
-
.new(name, payload, root) ⇒ AddVertex
constructor
Initialize an action to add a vertex to a dependency graph.
- #payload ⇒ Object readonly
- #root ⇒ Boolean readonly
Class Method Summary
Action
- Inherited
Instance Attribute Summary
Instance Method Summary
Action
- Inherited
Constructor Details
.new(name, payload, root) ⇒ AddVertex
Initialize an action to add a vertex to a dependency graph
Class Method Details
.action_name ⇒ Symbol
# File 'lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/add_vertex.rb', line 12
def self.action_name :add_vertex end
Instance Attribute Details
#name ⇒ String
(readonly)
# File 'lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/add_vertex.rb', line 43
attr_reader :name
#payload ⇒ Object
(readonly)
# File 'lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/add_vertex.rb', line 46
attr_reader :payload
#root ⇒ Boolean
(readonly)
# File 'lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/add_vertex.rb', line 49
attr_reader :root
Instance Method Details
#down(graph) ⇒ Void
Reverses the action on the given graph.
#up(graph) ⇒ Void
Performs the action on the given graph.
# File 'lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/add_vertex.rb', line 17
def up(graph) if existing = graph.vertices[name] @existing_payload = existing.payload @existing_root = existing.root end vertex = existing || Vertex.new(name, payload) graph.vertices[vertex.name] = vertex vertex.payload ||= payload vertex.root ||= root vertex end