iso-jsonpath 1.1.6 → 1.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0c58f2694eac62a528c76cbdd58c827a9269302570cf765ce4b65611696fac39
4
- data.tar.gz: 8331f78eb483639bb0b453c3ec72887bfbf91692982454a1476608ca2d32d012
3
+ metadata.gz: 1829e886c1f419b5d4223588879c98dfd72e222fcc0c8efd076d2b401bd8767f
4
+ data.tar.gz: 86ce4fbe392ea18a6e1312c6f4b42032de1dc9141f5058dd8ed2ac5ded975a25
5
5
  SHA512:
6
- metadata.gz: ede9bb040400866ea9a8f4674b86dc6b8d63c5774f984eb20c0a59238994a609fd5e2da42a6390d67d2e8133bb3e00acd8baa3650b8e452aa1cdfa65f3f7d74a
7
- data.tar.gz: 4b3f0ca17ee3229794e06b620a12e975bdd67d655ca5b0f82c63ffdddd932cc2267864afe4833788bd2ea99c9c11293c5c3437f7e2b5b89230a1c5e5ea3f008b
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 = ['Joshua Hull', 'Gergely Brautigam']
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 = ['joshbuddy@gmail.com', 'skarlso777@gmail.com']
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'
@@ -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(/\['[a-zA-Z@&*\/$%^?_ ]+'\]/))
72
- elements << t.gsub(/^\s*\[\s*'(.*)'\s*\]\s*$/, '\1')
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+)?/))
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class JsonPath
4
- VERSION = '1.1.6'
4
+ VERSION = '1.1.7'
5
5
  end
@@ -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.6
4
+ version: 1.1.7
5
5
  platform: ruby
6
6
  authors:
7
- - Joshua Hull
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
- - joshbuddy@gmail.com
115
- - skarlso777@gmail.com
113
+ - andy@iso.io
116
114
  executables:
117
115
  - jsonpath
118
116
  extensions: []