iso-jsonpath 1.1.6 → 1.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/jsonpath.gemspec +2 -2
- data/lib/jsonpath/parser.rb +2 -2
- data/lib/jsonpath/version.rb +1 -1
- data/test/test_jsonpath.rb +20 -0
- metadata +3 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1829e886c1f419b5d4223588879c98dfd72e222fcc0c8efd076d2b401bd8767f
|
4
|
+
data.tar.gz: 86ce4fbe392ea18a6e1312c6f4b42032de1dc9141f5058dd8ed2ac5ded975a25
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5983a51165fcf9f97dfc4b7826a57093dab102ac0a850081db3391d6bcf2ef1ed4d9c4e025b12d43d2594c05dcbdfa4bec5e6c38eda1651fa1df085535b6c850
|
7
|
+
data.tar.gz: c8e2d2ea29a819682998c6d00e8f4465ac2de5aea482edb57ae422762638d988fe1842fd935b0118778ded6b849d11d1eac283c00e1c30a6911a5f40299ff653
|
data/jsonpath.gemspec
CHANGED
@@ -6,10 +6,10 @@ Gem::Specification.new do |s|
|
|
6
6
|
s.name = 'iso-jsonpath'
|
7
7
|
s.version = JsonPath::VERSION
|
8
8
|
s.required_ruby_version = '>= 2.6'
|
9
|
-
s.authors = ['
|
9
|
+
s.authors = ['Isometric']
|
10
10
|
s.summary = 'Ruby implementation of http://goessner.net/articles/JsonPath/'
|
11
11
|
s.description = 'Ruby implementation of http://goessner.net/articles/JsonPath/.'
|
12
|
-
s.email = ['
|
12
|
+
s.email = ['andy@iso.io']
|
13
13
|
s.extra_rdoc_files = ['README.md']
|
14
14
|
s.files = `git ls-files`.split("\n")
|
15
15
|
s.homepage = 'https://github.com/joshbuddy/jsonpath'
|
data/lib/jsonpath/parser.rb
CHANGED
@@ -68,8 +68,8 @@ class JsonPath
|
|
68
68
|
scanner = StringScanner.new(exp)
|
69
69
|
elements = []
|
70
70
|
until scanner.eos?
|
71
|
-
if (t = scanner.scan(/\['
|
72
|
-
elements << t.gsub(/^\
|
71
|
+
if (t = scanner.scan(/\['((?<!\\).)+'\]/))
|
72
|
+
elements << t.gsub(/^\['(.*)'\]$/, '\1')
|
73
73
|
elsif (t = scanner.scan(/\.[a-zA-Z0-9_]+[?]?/))
|
74
74
|
elements << t.gsub(/[\[\]'.]|\s+/, '')
|
75
75
|
elsif (t = scanner.scan(/(\s+)?[<>=!\-+][=~]?(\s+)?/))
|
data/lib/jsonpath/version.rb
CHANGED
data/test/test_jsonpath.rb
CHANGED
@@ -592,6 +592,26 @@ class TestJsonpath < MiniTest::Unit::TestCase
|
|
592
592
|
assert_equal([{ 'with space' => 'urn:1' }], JsonPath.new("$.store[?(@['with space'])]").on(jsonld))
|
593
593
|
end
|
594
594
|
|
595
|
+
def test_hash_in_filter
|
596
|
+
jsonld = {
|
597
|
+
'store' => [
|
598
|
+
{ 'withouthash' => 'urn' },
|
599
|
+
{ 'with #' => 'urn:1' }
|
600
|
+
]
|
601
|
+
}
|
602
|
+
assert_equal([{ 'with #' => 'urn:1' }], JsonPath.new("$.store[?(@['with #'])]").on(jsonld))
|
603
|
+
end
|
604
|
+
|
605
|
+
def test_quote_in_filter
|
606
|
+
jsonld = {
|
607
|
+
'store' => [
|
608
|
+
{ 'withoutquote' => 'urn' },
|
609
|
+
{ 'with \'' => 'urn:1' }
|
610
|
+
]
|
611
|
+
}
|
612
|
+
assert_equal([{ 'with \'' => 'urn:1' }], JsonPath.new("$.store[?(@['with \''])]").on(jsonld))
|
613
|
+
end
|
614
|
+
|
595
615
|
def test_at_in_value
|
596
616
|
jsonld = {
|
597
617
|
'mentions' =>
|
metadata
CHANGED
@@ -1,11 +1,10 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: iso-jsonpath
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
8
|
-
- Gergely Brautigam
|
7
|
+
- Isometric
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
@@ -111,8 +110,7 @@ dependencies:
|
|
111
110
|
version: '0'
|
112
111
|
description: Ruby implementation of http://goessner.net/articles/JsonPath/.
|
113
112
|
email:
|
114
|
-
-
|
115
|
-
- skarlso777@gmail.com
|
113
|
+
- andy@iso.io
|
116
114
|
executables:
|
117
115
|
- jsonpath
|
118
116
|
extensions: []
|