lib/taketo/support/named_nodes_collection.rb in taketo-0.0.6 vs lib/taketo/support/named_nodes_collection.rb in taketo-0.0.7

- old
+ new

@@ -13,10 +13,11 @@ @nodes = nodes end def push(node) @nodes << node unless find_by_name(node.name) + self end alias :<< :push def [](index) if index.is_a?(Symbol) @@ -27,9 +28,18 @@ end def find_by_name(name) @nodes.detect { |n| n.name == name } end + + def ==(other) + return true if other.equal?(self) + @nodes == other.is_a?(NamedNodesCollection) ? other.nodes : other + end + + protected + + attr_reader :nodes end end end