jsonpath 1.0.4 → 1.0.5
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 +4 -4
 - data/lib/jsonpath/enumerable.rb +1 -1
 - data/lib/jsonpath/version.rb +1 -1
 - data/test/test_jsonpath.rb +13 -0
 - metadata +3 -4
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 2eda27c92a0608bfe616796cdfdfd8020db7e91f1246533d04e8d141fd2df17c
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 12bb579fd9915045afeffc02f6ef9c911b5dcf97597c20c8f7c2990bcacc58df
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: b7ad942b6146950aed615c56d3944f7888cded5dba6eeb76048db8489e56d19e978c380f43befa4a4914437e1880d4fddc3b0df8b447cea1c5dc60a32548b217
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 1d79042eefed77ca6956f6a75a148a695a9851afe6f72d99a490802a6aaaaf5abc84653fdc5aa296a31bf6151ac1965c2f6d85c55efd4915d3ced951eba11a40
         
     | 
    
        data/lib/jsonpath/enumerable.rb
    CHANGED
    
    | 
         @@ -64,7 +64,7 @@ class JsonPath 
     | 
|
| 
       64 
64 
     | 
    
         
             
                      if node.is_a?(Hash)
         
     | 
| 
       65 
65 
     | 
    
         
             
                        node[k] ||= nil if @options[:default_path_leaf_to_null]
         
     | 
| 
       66 
66 
     | 
    
         
             
                        each(node, k, pos + 1, &blk) if node.key?(k)
         
     | 
| 
       67 
     | 
    
         
            -
                      elsif node.respond_to?(k.to_s)
         
     | 
| 
      
 67 
     | 
    
         
            +
                      elsif node.respond_to?(k.to_s) && !Object.respond_to?(k.to_s)
         
     | 
| 
       68 
68 
     | 
    
         
             
                        each(node, k, pos + 1, &blk)
         
     | 
| 
       69 
69 
     | 
    
         
             
                      end
         
     | 
| 
       70 
70 
     | 
    
         
             
                    when '?'
         
     | 
    
        data/lib/jsonpath/version.rb
    CHANGED
    
    
    
        data/test/test_jsonpath.rb
    CHANGED
    
    | 
         @@ -909,6 +909,19 @@ class TestJsonpath < MiniTest::Unit::TestCase 
     | 
|
| 
       909 
909 
     | 
    
         
             
                assert_equal [{ 'cate gory' => 'reference', 'author' => 'Nigel Rees' }], JsonPath.on(json, "$.store.book[?(@['price'] == 8.95)](   cate gory, author   )")
         
     | 
| 
       910 
910 
     | 
    
         
             
              end
         
     | 
| 
       911 
911 
     | 
    
         | 
| 
      
 912 
     | 
    
         
            +
              def test_object_method_send
         
     | 
| 
      
 913 
     | 
    
         
            +
                j = {height: 5, hash: "some_hash"}.to_json
         
     | 
| 
      
 914 
     | 
    
         
            +
                hs = JsonPath.new "$..send"
         
     | 
| 
      
 915 
     | 
    
         
            +
                assert_equal([], hs.on(j))
         
     | 
| 
      
 916 
     | 
    
         
            +
                hs = JsonPath.new "$..hash"
         
     | 
| 
      
 917 
     | 
    
         
            +
                assert_equal(["some_hash"], hs.on(j))
         
     | 
| 
      
 918 
     | 
    
         
            +
                hs = JsonPath.new "$..send"
         
     | 
| 
      
 919 
     | 
    
         
            +
                assert_equal([], hs.on(j))
         
     | 
| 
      
 920 
     | 
    
         
            +
                j = {height: 5, send: "should_still_work"}.to_json
         
     | 
| 
      
 921 
     | 
    
         
            +
                hs = JsonPath.new "$..send"
         
     | 
| 
      
 922 
     | 
    
         
            +
                assert_equal(['should_still_work'], hs.on(j))
         
     | 
| 
      
 923 
     | 
    
         
            +
              end
         
     | 
| 
      
 924 
     | 
    
         
            +
             
     | 
| 
       912 
925 
     | 
    
         
             
              def example_object
         
     | 
| 
       913 
926 
     | 
    
         
             
                { 'store' => {
         
     | 
| 
       914 
927 
     | 
    
         
             
                  'book' => [
         
     | 
    
        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: 1.0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 1.0.5
         
     | 
| 
       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: 2019- 
     | 
| 
      
 12 
     | 
    
         
            +
            date: 2019-10-15 00:00:00.000000000 Z
         
     | 
| 
       13 
13 
     | 
    
         
             
            dependencies:
         
     | 
| 
       14 
14 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       15 
15 
     | 
    
         
             
              name: multi_json
         
     | 
| 
         @@ -158,8 +158,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       158 
158 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       159 
159 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       160 
160 
     | 
    
         
             
            requirements: []
         
     | 
| 
       161 
     | 
    
         
            -
             
     | 
| 
       162 
     | 
    
         
            -
            rubygems_version: 2.7.3
         
     | 
| 
      
 161 
     | 
    
         
            +
            rubygems_version: 3.0.6
         
     | 
| 
       163 
162 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       164 
163 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       165 
164 
     | 
    
         
             
            summary: Ruby implementation of http://goessner.net/articles/JsonPath/
         
     |