Method: TreeHash#find

Defined in:
lib/bblib/core/classes/tree_hash.rb

#find(path) ⇒ Object



68
69
70
71
72
73
74
75
76
77
78
# File 'lib/bblib/core/classes/tree_hash.rb', line 68

def find(path)
  path = HashPath.new(*path) unless path.is_a?(HashPath)
  matches = [self]
  path.parts.each do |part|
    break if matches.empty?
    matches = matches.flat_map do |match|
      part.matches(match)
    end
  end
  matches
end