lib/jsonpath/parser.rb in jsonpath-0.8.2 vs lib/jsonpath/parser.rb in jsonpath-0.8.3
- old
+ new
@@ -51,9 +51,10 @@
private
# @TODO: Remove this once JsonPath no longer supports ruby versions below 2.3
def dig(keys, hash)
+ return hash unless hash.is_a? Hash
return nil unless hash.key?(keys.first)
return hash.fetch(keys.first) if keys.size == 1
prev = keys.shift
dig(keys, hash.fetch(prev))
end