123456789_123456789_123456789_123456789_123456789_

Class: Gem::Resolver::Molinillo::DependencyGraph::DeleteEdge

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/delete_edge.rb

Overview

(see #delete_edge)

Action

DeleteEdge

Class Method Summary

Action - Inherited

Instance Attribute Summary

Action - Inherited

Instance Method Summary

Action - Inherited

#down

Reverses the action on the given graph.

#up

Performs the action on the given graph.

Constructor Details

.new(origin_name, destination_name, requirement) ⇒ DeleteEdge

Initialize an action to add an edge to a dependency graph

Parameters:

  • origin_name (String)

    the name of the origin of the edge

  • destination_name (String)

    the name of the destination of the edge

  • requirement (Object)

    the requirement that the edge represents

[ GitHub ]

  
# File 'lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/delete_edge.rb', line 56

def initialize(origin_name, destination_name, requirement)
  @origin_name = origin_name
  @destination_name = destination_name
  @requirement = requirement
end

Class Method Details

.action_nameSymbol

Returns:

  • (Symbol)

    The name of the action.

[ GitHub ]

  
# File 'lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/delete_edge.rb', line 12

def self.action_name
  :delete_edge
end

Instance Attribute Details

#destination_nameString (readonly)

Returns:

  • (String)

    the name of the destination of the edge

[ GitHub ]

  
# File 'lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/delete_edge.rb', line 37

attr_reader :destination_name

#origin_nameString (readonly)

Returns:

  • (String)

    the name of the origin of the edge

[ GitHub ]

  
# File 'lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/delete_edge.rb', line 34

attr_reader :origin_name

#requirementObject (readonly)

Returns:

  • (Object)

    the requirement that the edge represents

[ GitHub ]

  
# File 'lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/delete_edge.rb', line 40

attr_reader :requirement

Instance Method Details

#down(graph) ⇒ Void

Reverses the action on the given graph.

Parameters:

[ GitHub ]

  
# File 'lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/delete_edge.rb', line 24

def down(graph)
  edge = make_edge(graph)
  edge.origin.outgoing_edges << edge
  edge.destination.incoming_edges << edge
  edge
end

#make_edge(graph) ⇒ Edge

Parameters:

Returns:

  • (Edge)

    The edge this action adds

[ GitHub ]

  
# File 'lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/delete_edge.rb', line 44

def make_edge(graph)
  Edge.new(
    graph.vertex_named(origin_name),
    graph.vertex_named(destination_name),
    requirement
  )
end

#up(graph) ⇒ Void

Performs the action on the given graph.

Parameters:

[ GitHub ]

  
# File 'lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/delete_edge.rb', line 17

def up(graph)
  edge = make_edge(graph)
  edge.origin.outgoing_edges.delete(edge)
  edge.destination.incoming_edges.delete(edge)
end