lib/psd/nodes/ancestry.rb in psd-1.1.0 vs lib/psd/nodes/ancestry.rb in psd-1.1.1

- old
+ new

@@ -48,20 +48,24 @@ siblings.length == 1 end # Recursively get all descendant nodes, not including this node. def descendants - children + children.map(&:children).flatten + children.map(&:subtree).flatten end # Same as descendants, except it includes this node. def subtree [self] + descendants end # Depth from the root node. Root depth is 0. def depth return ancestors.length + 1 + end + + def path + (ancestors.map(&:name) + [name]).join('/') end def method_missing(method, *args, &block) test = /^(.+)_(layers|groups)$/.match(method) if test \ No newline at end of file