class Bundler::Molinillo::DependencyGraph::DetachVertexNamed
@!visibility private @see DependencyGraph#detach_vertex_named
Attributes
 name[R] 
 @return [String] the name of the vertex to detach
Public Class Methods
# File lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb, line 12 def self.action_name :add_vertex end
(see Action#name)
# File lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb, line 56 def initialize(name) @name = name end
Initialize an action to detach a vertex from a dependency graph @param [String] name the name of the vertex to detach
Public Instance Methods
# File lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb, line 38
def down(graph)
  return unless @vertex
  graph.vertices[@vertex.name] = @vertex
  @vertex.outgoing_edges.each do |e|
    e.destination.incoming_edges << e
  end
  @vertex.incoming_edges.each do |e|
    e.origin.outgoing_edges << e
  end
end (see Action#down)
# File lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb, line 17
def up(graph)
  return [] unless @vertex = graph.vertices.delete(name)
  removed_vertices = [@vertex]
  @vertex.outgoing_edges.each do |e|
    v = e.destination
    v.incoming_edges.delete(e)
    if !v.root? && v.incoming_edges.empty?
      removed_vertices.concat graph.detach_vertex_named(v.name)
    end
  end
  @vertex.incoming_edges.each do |e|
    v = e.origin
    v.outgoing_edges.delete(e)
  end
  removed_vertices
end (see Action#up)
    Ruby Core © 1993–2017 Yukihiro Matsumoto
Licensed under the Ruby License.
Ruby Standard Library © contributors
Licensed under their own licenses.