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 11
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 42
attr_reader :name
#payload ⇒ Object
(readonly)
# File 'lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/add_vertex.rb', line 45
attr_reader :payload
#root ⇒ Boolean
(readonly)
# File 'lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/add_vertex.rb', line 48
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 16
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