Module: JSONPath

Defined in:
lib/jsonpath.rb,
lib/jsonpath/nodes.rb

Defined Under Namespace

Modules: Nodes Classes: ParseError

Constant Summary collapse

Parser =
::JSONPathGrammarParser

Class Method Summary collapse

Class Method Details

.lookup(obj, path) ⇒ Object



13
14
15
16
17
18
19
20
# File 'lib/jsonpath.rb', line 13

def self.lookup(obj, path)
  parser = Parser.new
  if (result = parser.parse(path))
    result.walk(obj)
  else
    raise ParseError, parser.failure_reason
  end
end