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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 92cc1431a2d3381ea1a5942316f4c0884a84249c
4
- data.tar.gz: 810157f1beaf693630d191774bc3536cb0ee0828
3
+ metadata.gz: 966e3b0fe3897b291f4986554eab5505834ae395
4
+ data.tar.gz: c5765190e2274b20387c0cdd477c76091a3b7af3
5
5
  SHA512:
6
- metadata.gz: e5be1e7f785e4a9925d6990c4509af7e932f2cbfe82a48574a20466eb81e40a3ebdb760b21774fa4208b0ea1758f6dde4d27e3fb8df76f349e7b84bb5208ccbd
7
- data.tar.gz: c6d8effb1c4764cc3587c691ab5610acb35e1eaf758c76c69ec09905105f77a796ebbaa6a72b42332524645bdee6fbfeee3dd2dc1ac3f944aa8f00df36f2ab11
6
+ metadata.gz: ec8346c801fece96fa75b56dce3611fab9fd6b2b3eec9bf05264ed0c27a21b34460412e1232502f868cd8677e16353c5676dfb9bcfeae963d78fac6a95eb46b6
7
+ data.tar.gz: 7a5eb3b65176488311eb1467fbbecad8a1df4a7adc57a3f76546e67cda6733331fabc612b3afc127f06a61b236dee125e738bae1b543f601b1844a7feb609870
@@ -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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class JsonPath
4
- VERSION = '0.9.5'.freeze
4
+ VERSION = '0.9.6'.freeze
5
5
  end
@@ -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.5
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-15 00:00:00.000000000 Z
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.4.6
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/