jsonpath 0.9.5 → 0.9.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/jsonpath.rb +3 -1
- data/lib/jsonpath/version.rb +1 -1
- data/test/test_jsonpath.rb +7 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 966e3b0fe3897b291f4986554eab5505834ae395
|
4
|
+
data.tar.gz: c5765190e2274b20387c0cdd477c76091a3b7af3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ec8346c801fece96fa75b56dce3611fab9fd6b2b3eec9bf05264ed0c27a21b34460412e1232502f868cd8677e16353c5676dfb9bcfeae963d78fac6a95eb46b6
|
7
|
+
data.tar.gz: 7a5eb3b65176488311eb1467fbbecad8a1df4a7adc57a3f76546e67cda6733331fabc612b3afc127f06a61b236dee125e738bae1b543f601b1844a7feb609870
|
data/lib/jsonpath.rb
CHANGED
@@ -21,7 +21,7 @@ class JsonPath
|
|
21
21
|
until scanner.eos?
|
22
22
|
if token = scanner.scan(/\$\B|@\B|\*|\.\./)
|
23
23
|
@path << token
|
24
|
-
elsif token = scanner.scan(/[\$@a-zA-Z0-9:_-]+/)
|
24
|
+
elsif token = scanner.scan(/[\$@a-zA-Z0-9:{}_-]+/)
|
25
25
|
@path << "['#{token}']"
|
26
26
|
elsif token = scanner.scan(/'(.*?)'/)
|
27
27
|
@path << "[#{token}]"
|
@@ -33,6 +33,8 @@ class JsonPath
|
|
33
33
|
nil
|
34
34
|
elsif token = scanner.scan(/[><=] \d+/)
|
35
35
|
@path.last << token
|
36
|
+
# TODO: If there are characters that it can't match in the previous legs, this will throw
|
37
|
+
# a RuntimeError: can't modify frozen String error.
|
36
38
|
elsif token = scanner.scan(/./)
|
37
39
|
@path.last << token
|
38
40
|
end
|
data/lib/jsonpath/version.rb
CHANGED
data/test/test_jsonpath.rb
CHANGED
@@ -603,6 +603,13 @@ class TestJsonpath < MiniTest::Unit::TestCase
|
|
603
603
|
assert_equal [{"name" => "King\'s Speech"}], JsonPath.on(json, "$..channels[?(@.name == 'King\'s Speech')]")
|
604
604
|
end
|
605
605
|
|
606
|
+
def test_curly_brackets
|
607
|
+
data = {
|
608
|
+
'{data}' => 'data'
|
609
|
+
}
|
610
|
+
assert_equal ['data'], JsonPath.new("$.{data}").on(data)
|
611
|
+
end
|
612
|
+
|
606
613
|
def test_changed
|
607
614
|
json =
|
608
615
|
{
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jsonpath
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joshua Hull
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2018-10-
|
12
|
+
date: 2018-10-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: multi_json
|
@@ -159,7 +159,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
159
159
|
version: '0'
|
160
160
|
requirements: []
|
161
161
|
rubyforge_project: jsonpath
|
162
|
-
rubygems_version: 2.
|
162
|
+
rubygems_version: 2.6.13
|
163
163
|
signing_key:
|
164
164
|
specification_version: 4
|
165
165
|
summary: Ruby implementation of http://goessner.net/articles/JsonPath/
|