jsonpath 0.0.2 → 0.0.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.
data/README.rdoc ADDED
@@ -0,0 +1,28 @@
1
+ = Jsonpath
2
+
3
+ This is an implementation of http://goessner.net/articles/JsonPath/.
4
+
5
+ == Usage
6
+
7
+ wrapper = JsonPath.wrap(JSON.parse(<<-HERE_DOC))
8
+ {"store":
9
+ {"bicycle":
10
+ {"price":19.95, "color":"red"},
11
+ "book":[
12
+ {"price":8.95, "category":"reference", "title":"Sayings of the Century", "author":"Nigel Rees"},
13
+ {"price":12.99, "category":"fiction", "title":"Sword of Honour", "author":"Evelyn Waugh"},
14
+ {"price":8.99, "category":"fiction", "isbn":"0-553-21311-3", "title":"Moby Dick", "author":"Herman Melville"},
15
+ {"price":22.99, "category":"fiction", "isbn":"0-395-19395-8", "title":"The Lord of the Rings", "author":"J. R. R. Tolkien"}
16
+ ]
17
+ }
18
+ }
19
+ HERE_DOC
20
+
21
+ wrapper.path('$..price').to_a
22
+ => [19.95, 8.95, 12.99, 8.99, 22.99]
23
+
24
+ wrapper.path('$..author').to_a
25
+ => ["Nigel Rees", "Evelyn Waugh", "Herman Melville", "J. R. R. Tolkien"]
26
+
27
+ wrapper.path('$..book[::2]').to_a
28
+ => [{"price"=>8.95, "category"=>"reference", "author"=>"Nigel Rees", "title"=>"Sayings of the Century"}, {"price"=>8.99, "category"=>"fiction", "author"=>"Herman Melville", "title"=>"Moby Dick", "isbn"=>"0-553-21311-3"}]
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.2
1
+ 0.0.3
data/lib/jsonpath.rb CHANGED
@@ -1,3 +1,4 @@
1
+ $LOAD_PATH << File.expand_path(File.dirname(__FILE__))
1
2
  require File.join('jsonpath', 'expression')
2
3
  require File.join('jsonpath', 'wrapper')
3
4
 
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.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joshua Hull
@@ -20,11 +20,9 @@ executables: []
20
20
  extensions: []
21
21
 
22
22
  extra_rdoc_files:
23
- - README.txt
23
+ - README.rdoc
24
24
  files:
25
- - History.txt
26
- - Manifest.txt
27
- - README.txt
25
+ - README.rdoc
28
26
  - Rakefile
29
27
  - VERSION
30
28
  - lib/jsonpath.rb
data/History.txt DELETED
@@ -1,4 +0,0 @@
1
- == 0.0.1 2008-11-28
2
-
3
- * 1 major enhancement:
4
- * Initial release
data/Manifest.txt DELETED
@@ -1,11 +0,0 @@
1
- History.txt
2
- Manifest.txt
3
- PostInstall.txt
4
- README.rdoc
5
- Rakefile
6
- lib/jsonpath.rb
7
- script/console
8
- script/destroy
9
- script/generate
10
- test/test_helper.rb
11
- test/test_jsonpath.rb
data/README.txt DELETED
@@ -1,46 +0,0 @@
1
- = jsonpath
2
-
3
- == DESCRIPTION:
4
-
5
- * FIX (describe your package)
6
-
7
- == FEATURES/PROBLEMS:
8
-
9
- * FIX (list of features or problems)
10
-
11
- == SYNOPSIS:
12
-
13
- FIX (code sample of usage)
14
-
15
- == REQUIREMENTS:
16
-
17
- * FIX (list of requirements)
18
-
19
- == INSTALL:
20
-
21
- * FIX (sudo gem install, anything else)
22
-
23
- == LICENSE:
24
-
25
- (The MIT License)
26
-
27
- Copyright (c) 2008 FIXME full name
28
-
29
- Permission is hereby granted, free of charge, to any person obtaining
30
- a copy of this software and associated documentation files (the
31
- 'Software'), to deal in the Software without restriction, including
32
- without limitation the rights to use, copy, modify, merge, publish,
33
- distribute, sublicense, and/or sell copies of the Software, and to
34
- permit persons to whom the Software is furnished to do so, subject to
35
- the following conditions:
36
-
37
- The above copyright notice and this permission notice shall be
38
- included in all copies or substantial portions of the Software.
39
-
40
- THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
41
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
42
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
43
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
44
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
45
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
46
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.