lib/jsonpath.rb in jsonpath-1.1.4 vs lib/jsonpath.rb in jsonpath-1.1.5
- old
+ new
@@ -78,11 +78,11 @@
res
end
def on(obj_or_str, opts = {})
a = enum_on(obj_or_str).to_a
- if opts[:symbolize_keys]
+ if symbolize_keys?(opts)
a.map! do |e|
e.each_with_object({}) { |(k, v), memo| memo[k.to_sym] = v; }
end
end
a
@@ -150,7 +150,11 @@
end
def set_max_nesting
return unless @opts[:max_nesting].is_a?(Integer) && @opts[:max_nesting] > MAX_NESTING_ALLOWED
@opts[:max_nesting] = false
+ end
+
+ def symbolize_keys?(opts)
+ opts.fetch(:symbolize_keys, @opts&.dig(:symbolize_keys))
end
end