joshbuddy/jsonpath

`symbolize_keys` option doesn't work as the README says

marciondg opened this issue · 1 comments

Hi everyone!
Checking the README I found this interesting option

image

However, when I tested it in my project, it didn't work as expected

image

Looking over the implementation, I detected that it uses a symbolize_keys expected in the on options, ignoring the sent during the initialization.

jsonpath/lib/jsonpath.rb

Lines 79 to 87 in 4e31ac9

def on(obj_or_str, opts = {})
a = enum_on(obj_or_str).to_a
if opts[:symbolize_keys]
a.map! do |e|
e.each_with_object({}) { |(k, v), memo| memo[k.to_sym] = v; }
end
end
a
end

So, I tried as follows and it worked!
image

Should the documentation be modified or rather the implementation?
Thanks!

I have tried to fix above issue, kindly check @joshbuddy

#165