jsonpathv2 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/jsonpathv2.rb +1 -1
- data/lib/jsonpathv2/version.rb +1 -1
- data/test/test_jsonpath.rb +7 -2
- 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: 9b01dba13429a0d79b7de7c7d940a7e12a84bb5f
|
4
|
+
data.tar.gz: 2dfd060566c1220b372963955e09599c3a512b6f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0c111a51ccbb81bc5f042f599a78da5258ad2a01dbaa1159c9fc10417b366d87a68a56137caefaf88b29fa355661b80c706c670306bba3cda2ea68d3dd5e823e
|
7
|
+
data.tar.gz: 7527c3c63441d05b853dcacc9b17e7eb7e5750034bdb111bf135d3fb4f89995edefc45dbea7e68d3b8d32d250c8a363ccc9211cd4c89732878e6e8f0f835d52f
|
data/lib/jsonpathv2.rb
CHANGED
@@ -18,7 +18,7 @@ class JsonPath
|
|
18
18
|
until scanner.eos?
|
19
19
|
if token = scanner.scan(/\$|@\B|\*|\.\./)
|
20
20
|
@path << token
|
21
|
-
elsif token = scanner.scan(/[\$@a-zA-Z0-
|
21
|
+
elsif token = scanner.scan(/[\$@a-zA-Z0-9:_-]+/)
|
22
22
|
@path << "['#{token}']"
|
23
23
|
elsif token = scanner.scan(/'(.*?)'/)
|
24
24
|
@path << "[#{token}]"
|
data/lib/jsonpathv2/version.rb
CHANGED
data/test/test_jsonpath.rb
CHANGED
@@ -78,6 +78,10 @@ class TestJsonpath < MiniTest::Unit::TestCase
|
|
78
78
|
assert_equal [@object['store']['bicycle']['single-speed']], JsonPath.new('$.store.bicycle.single-speed').on(@object)
|
79
79
|
end
|
80
80
|
|
81
|
+
def test_path_with_colon
|
82
|
+
assert_equal [@object['store']['bicycle']['make:model']], JsonPath.new('$.store.bicycle.make:model').on(@object)
|
83
|
+
end
|
84
|
+
|
81
85
|
def test_paths_with_numbers
|
82
86
|
assert_equal [@object['store']['bicycle']['2seater']], JsonPath.new('$.store.bicycle.2seater').on(@object)
|
83
87
|
end
|
@@ -91,7 +95,7 @@ class TestJsonpath < MiniTest::Unit::TestCase
|
|
91
95
|
end
|
92
96
|
|
93
97
|
def test_counting
|
94
|
-
assert_equal
|
98
|
+
assert_equal 50, JsonPath.new('$..*').on(@object).to_a.size
|
95
99
|
end
|
96
100
|
|
97
101
|
def test_space_in_path
|
@@ -256,7 +260,8 @@ class TestJsonpath < MiniTest::Unit::TestCase
|
|
256
260
|
'price' => 20,
|
257
261
|
'catalogue_number' => 123_45,
|
258
262
|
'single-speed' => 'no',
|
259
|
-
'2seater' => 'yes'
|
263
|
+
'2seater' => 'yes',
|
264
|
+
'make:model' => 'Zippy Sweetwheeler'
|
260
265
|
}
|
261
266
|
} }
|
262
267
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jsonpathv2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gergely Brautigam
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-03-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: multi_json
|
@@ -139,7 +139,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
139
139
|
version: '0'
|
140
140
|
requirements: []
|
141
141
|
rubyforge_project: jsonpathv2
|
142
|
-
rubygems_version: 2.6.
|
142
|
+
rubygems_version: 2.6.10
|
143
143
|
signing_key:
|
144
144
|
specification_version: 4
|
145
145
|
summary: Ruby implementation of http://goessner.net/articles/JsonPath/
|