Sha256: 0a8871605ba311bd7dc8d1dacbb61c831b0da793d4b064928db017bd38d87eae
Contents?: true
Size: 816 Bytes
Versions: 13
Compression:
Stored size: 816 Bytes
Contents
class PSD class Node module Search # Searches the tree structure for a node at the given path. The path is # defined by the layer/folder names. Because the PSD format does not # require unique layer/folder names, we always return an array of all # found nodes. def children_at_path(path, opts={}) path = path.split('/').delete_if { |p| p == "" } unless path.is_a?(Array) query = path.shift matches = children.select do |c| if opts[:case_sensitive] c.name == query else c.name.downcase == query.downcase end end if path.length == 0 return matches else return matches.map { |m| m.children_at_path(path, opts) }.flatten end end end end end
Version data entries
13 entries across 13 versions & 1 rubygems