jsonwalk 1.1.2 → 1.1.3

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
  SHA1:
3
- metadata.gz: f8ca16105bd17da8a1082049a7ab632974040680
4
- data.tar.gz: b238a9f1055435af9e6a9fce2fce53f076510450
3
+ metadata.gz: fbc4411bda3bbf86e7283ec025966c8083758448
4
+ data.tar.gz: 81af4016eb6f32f448e92f3cba5c450bb7c8087d
5
5
  SHA512:
6
- metadata.gz: 15b46589fa5df9d53faeaaa3e2536f9b098a853c01214bfde27069ba9dfcd343b58a944e61edf019cfc9b217e2348397f91d5edbe6df17edfe9a58ea0bc4df3c
7
- data.tar.gz: be4904e6a7ddab81cef1ccc1e60f32de46621236f9fce3ce8442ec6b4df33f82730067678fa5c2cbca38b11549d2f7a77d1698b65d958e901cf85984cda81da5
6
+ metadata.gz: 0fa0b58799398f2d8d90c355883abe4af6c4239b9944fc9b0450885b5ca8f19f9c4f8108e7fa9ccc09d9180b09e56f4e7135348bdd23da70e81ca4018ba9c59b
7
+ data.tar.gz: e7e8fdaf51dc2d724fa21ee12d40aad761e7897c0ca9c50af3905fc463df201de32d1e1bbf84b75f83b1200e7c5137c65f16b9b558bbc4a5021086b2d56539f9
data/README.md CHANGED
@@ -69,9 +69,8 @@ jsonwalk provides functions to walk in a JSON tree created with JSON.parse
69
69
 
70
70
  ## Examples
71
71
  Consider this Json object provided as the pjson2.txt file :
72
- {
73
- "food":
74
- [
72
+ {
73
+ "food": [
75
74
  {
76
75
  "id": "0001",
77
76
  "type": "donut",
@@ -92,33 +91,32 @@ jsonwalk provides functions to walk in a JSON tree created with JSON.parse
92
91
  }
93
92
  ]
94
93
  },
95
- ]
96
- }
94
+ ] }
97
95
 
98
- You can use the file test/cli_jsonwalk.rb to parse it with the syntax:
96
+ You can use the file test/cli_jsonwalk.rb to parse it with the syntax:
99
97
  cli_jsonwalk.rb pjson2.txt path
100
98
 
101
- 1. get the value corresponding to the name food :
102
- $ ruby test_jsonwalk.rb pjson2.txt food
103
- ["food"] ==> [{"id"=>"0001", "type"=>"donut", "ingredients"=>[{"flour"=>200}, {"eggs"=>3}]}, {"id"=>"0002", "type"=>"cookie", "ingredients"=>[{"flour"=>100}, {"chocolate"=>50}]}]
104
-
105
- 2. get the values corresponding to the path food,type
106
- $ ruby test_jsonwalk.rb pjson2.txt food/type
107
- ["food", "type"] ==> ["donut", "cookie"]
108
-
109
- 3. get the ingredients for the elements of type donut
110
- $ ruby test_jsonwalk.rb pjson2.txt food/type==donut/ingredients
111
- ["food", "type==donut", "ingredients"] ==> [[{"flour"=>200}, {"eggs"=>3}]]
112
-
113
- 4. get the type of elements which needs chocolate
114
- $ ruby test_jsonwalk.rb pjson2.txt food/ingredients/chocolate/../../type
115
- ["food", "ingredients", "chocolate", "..", "..", "type"] ==> ["cookie"]
116
-
117
- 5. get the second ingredient for the type donut
118
- $ ruby test_jsonwalk.rb pjson2.txt food/type==donut/ingredients/0/1
119
- ["food", "type==donut", "ingredients", 0, 1] ==> {"eggs"=>3}
120
-
121
- Note that the selection type==donut does not remove the food array but propagate it
99
+ 1. get the value corresponding to the name food :
100
+ $ ruby test_jsonwalk.rb pjson2.txt food
101
+ ["food"] ==> [{"id"=>"0001", "type"=>"donut", "ingredients"=>[{"flour"=>200}, {"eggs"=>3}]}, {"id"=>"0002", "type"=>"cookie", "ingredients"=>[{"flour"=>100}, {"chocolate"=>50}]}]
102
+
103
+ 2. get the values corresponding to the path food,type
104
+ $ ruby test_jsonwalk.rb pjson2.txt food/type
105
+ ["food", "type"] ==> ["donut", "cookie"]
106
+
107
+ 3. get the ingredients for the elements of type donut
108
+ $ ruby test_jsonwalk.rb pjson2.txt food/type==donut/ingredients
109
+ ["food", "type==donut", "ingredients"] ==> [[{"flour"=>200}, {"eggs"=>3}]]
110
+
111
+ 4. get the type of elements which needs chocolate
112
+ $ ruby test_jsonwalk.rb pjson2.txt food/ingredients/chocolate/../../type
113
+ ["food", "ingredients", "chocolate", "..", "..", "type"] ==> ["cookie"]
114
+
115
+ 5. get the second ingredient for the type donut
116
+ $ ruby test_jsonwalk.rb pjson2.txt food/type==donut/ingredients/0/1
117
+ ["food", "type==donut", "ingredients", 0, 1] ==> {"eggs"=>3}
118
+
119
+ Note that the selection type==donut does not remove the food array but propagate it
122
120
 
123
121
 
124
122
  ## Development
Binary file
@@ -1,3 +1,3 @@
1
1
  module JsonWalk
2
- VERSION = "1.1.2"
2
+ VERSION = "1.1.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jsonwalk
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Philippe Jounin
@@ -56,6 +56,7 @@ files:
56
56
  - bin/setup
57
57
  - jsonwalk-1.1.0.gem
58
58
  - jsonwalk-1.1.1.gem
59
+ - jsonwalk-1.1.2.gem
59
60
  - jsonwalk.gemspec
60
61
  - lib/jsonwalk.rb
61
62
  - lib/jsonwalk/version.rb