lib/jsonpath.rb in jsonpath-0.9.5 vs lib/jsonpath.rb in jsonpath-0.9.6

- old
+ new

@@ -19,11 +19,11 @@ scanner = StringScanner.new(path.strip) @path = [] until scanner.eos? if token = scanner.scan(/\$\B|@\B|\*|\.\./) @path << token - elsif token = scanner.scan(/[\$@a-zA-Z0-9:_-]+/) + elsif token = scanner.scan(/[\$@a-zA-Z0-9:{}_-]+/) @path << "['#{token}']" elsif token = scanner.scan(/'(.*?)'/) @path << "[#{token}]" elsif token = scanner.scan(/\[/) @path << find_matching_brackets(token, scanner) @@ -31,9 +31,11 @@ raise ArgumentError, 'unmatched closing bracket' elsif scanner.scan(/\./) nil elsif token = scanner.scan(/[><=] \d+/) @path.last << token + # TODO: If there are characters that it can't match in the previous legs, this will throw + # a RuntimeError: can't modify frozen String error. elsif token = scanner.scan(/./) @path.last << token end end end