lib/dr/base/graph.rb in drain-0.5.1 vs lib/dr/base/graph.rb in drain-0.6.0

- old
+ new

@@ -223,18 +223,21 @@ def bottom @nodes.select{ |n| n.children.length == 0}.sort end # allow a hash too - def |(graph) + def merge!(graph) graph=Graph.new(graph, **{}) unless Graph===graph build(*graph.all, recursive: false) end - def +(graph) + def merge(graph) clone.|(graph) end + alias | merge! + alias + merge + def dump(mode: :graph, nodes_list: :roots, show_attr: true, out: [], **_opts) n=case nodes_list when :roots; roots when :all; all when Symbol; nodes.select {|n| n.attributes[:nodes_list]} @@ -375,10 +378,10 @@ g-(new_nodes) elsif recursive while !new_nodes.empty? g2=yield(*new_nodes) g2=Graph.new(g2) unless g2.is_a?(Graph) - g|g2 + g.merge!(g2) nodes=nodes.concat(new_nodes) new_nodesg.nodes.map(&:name)-nodes end g else