Class: Gem::Resolver::Molinillo::DependencyGraph::AddEdgeNoCircular
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_edge_no_circular.rb |
Overview
(see #add_edge_no_circular)
Action
- .action_name ⇒ Symbol
-
#down(graph) ⇒ Void
Reverses the action on the given graph.
-
#up(graph) ⇒ Void
Performs the action on the given graph.
AddEdgeNoCircular
- #delete_first(array, item) private
- #destination ⇒ String readonly
- #make_edge(graph) ⇒ Edge
-
.new(origin, destination, requirement) ⇒ AddEdgeNoCircular
constructor
Initialize an action to add an edge to a dependency graph.
- #origin ⇒ String readonly
- #requirement ⇒ Object readonly
Class Method Summary
Action
- Inherited
Instance Attribute Summary
Instance Method Summary
Action
- Inherited
Constructor Details
.new(origin, destination, requirement) ⇒ AddEdgeNoCircular
Initialize an action to add an edge to a dependency graph
# File 'lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb', line 52
def initialize(origin, destination, requirement) @origin = origin @destination = destination @requirement = requirement end
Class Method Details
.action_name ⇒ Symbol
# File 'lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb', line 12
def self.action_name :add_vertex end
Instance Attribute Details
#destination ⇒ String
(readonly)
# File 'lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb', line 37
attr_reader :destination
#origin ⇒ String
(readonly)
# File 'lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb', line 34
attr_reader :origin
#requirement ⇒ Object
(readonly)
# File 'lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb', line 40
attr_reader :requirement
Instance Method Details
#delete_first(array, item) (private)
[ GitHub ]# File 'lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb', line 60
def delete_first(array, item) return unless index = array.index(item) array.delete_at(index) end
#down(graph) ⇒ Void
Reverses the action on the given graph.
# File 'lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb', line 25
def down(graph) edge = make_edge(graph) delete_first(edge.origin.outgoing_edges, edge) delete_first(edge.destination.incoming_edges, edge) end
#make_edge(graph) ⇒ Edge
# File 'lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb', line 44
def make_edge(graph) Edge.new(graph.vertex_named(origin), graph.vertex_named(destination), requirement) end
#up(graph) ⇒ Void
Performs the action on the given graph.
# File 'lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb', line 17
def up(graph) edge = make_edge(graph) edge.origin.outgoing_edges << edge edge.destination.incoming_edges << edge edge end