class Gem::Molinillo::DependencyGraph::AddEdgeNoCircular
@!visibility private (参见 DependencyGraph#add_edge_no_circular
)
属性
destination[R]
@return [String] 边的目的地的名称
origin[R]
@return [String] 边的起点的名称
requirement[R]
@return [Object] 边所代表的需求
公共类方法
action_name() 点击切换源代码
(参见 Action.action_name
)
# File rubygems/vendor/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb, line 12 def self.action_name :add_vertex end
new(origin, destination, requirement) 点击切换源代码
初始化一个在依赖关系图中添加边的操作 @param [String] origin 边的起点的名称 @param [String] destination 边的目的地的名称 @param [Object] requirement 边所代表的需求
# File rubygems/vendor/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb, line 52 def initialize(origin, destination, requirement) @origin = origin @destination = destination @requirement = requirement end
公共实例方法
down(graph) 点击切换源代码
(参见 Action#down
)
# File rubygems/vendor/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) 点击切换源代码
@param [DependencyGraph] graph 从中查找顶点的图 @return [Edge] 此操作添加的边
# File rubygems/vendor/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) 点击切换源代码
(参见 Action#up
)
# File rubygems/vendor/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
私有实例方法
delete_first(array, item) 点击切换源代码
# File rubygems/vendor/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