Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added option to disable runtime exceptions #10

Merged
merged 2 commits into from
Mar 31, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/jmespath.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ class << self
# @param [Hash] data
# @return [Mixed,nil] Returns the matched values. Returns `nil` if the
# expression does not resolve inside `data`.
def search(expression, data)
def search(expression, data, runtime_options = {})
data = case data
when Hash, Struct then data # check for most common case first
when Pathname then load_json(data)
when IO, StringIO then JSON.load(data.read)
else data
end
Runtime.new.search(expression, data)
Runtime.new(runtime_options).search(expression, data)
end

# @api private
Expand Down
Loading