lib/jsonpath.rb in jsonpath-0.9.1 vs lib/jsonpath.rb in jsonpath-0.9.2
- old
+ new
@@ -10,11 +10,11 @@
class JsonPath
PATH_ALL = '$..*'.freeze
attr_accessor :path
- def initialize(path, opts = nil)
+ def initialize(path, opts = {})
@opts = opts
scanner = StringScanner.new(path.strip)
@path = []
until scanner.eos?
if token = scanner.scan(/\$\B|@\B|\*|\.\./)
@@ -73,10 +73,10 @@
JsonPath::Enumerable.new(self, self.class.process_object(obj_or_str), mode,
@opts)
end
alias_method :[], :enum_on
- def self.on(obj_or_str, path, opts = nil)
+ def self.on(obj_or_str, path, opts = {})
new(path, opts).on(process_object(obj_or_str))
end
def self.for(obj_or_str)
Proxy.new(process_object(obj_or_str))