module JMESPath
Constants
- VERSION
Public Instance Methods
load_json(path)
click to toggle source
@api private
# File lib/jmespath.rb, line 36 def load_json(path) MultiJson.load(File.open(path, 'r', encoding: 'UTF-8') { |f| f.read }) end
search(expression, data)
click to toggle source
@param [String] expression A valid
[JMESPath](https://github.com/boto/jmespath) expression.
@param [Hash] data @return [Mixed,nil] Returns the matched values. Returns `nil` if the
expression does not resolve inside `data`.
# File lib/jmespath.rb, line 25 def search(expression, data) data = case data when Hash, Struct then data # check for most common case first when Pathname then load_json(data) when IO, StringIO then MultiJson.load(data.read) else data end Runtime.new.search(expression, data) end