yaji 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/HISTORY.markdown +4 -0
- data/README.markdown +1 -1
- data/ext/yaji/parser_ext.c +1 -1
- data/lib/yaji/version.rb +1 -1
- data/test/test_parser.rb +6 -6
- data/yaji.gemspec +1 -0
- metadata +19 -10
data/HISTORY.markdown
CHANGED
data/README.markdown
CHANGED
@@ -92,7 +92,7 @@ specify additional selector if you need to fetch some sibling nodes,
|
|
92
92
|
e.g. `"size"` from previous example:
|
93
93
|
|
94
94
|
parser = YAJI::Parser.new('{"size":2,"items":[{"id":1}, {"id":2}]}')
|
95
|
-
parser.each("size", "items/") do |obj|
|
95
|
+
parser.each(["size", "items/"]) do |obj|
|
96
96
|
puts obj.inspect
|
97
97
|
end
|
98
98
|
|
data/ext/yaji/parser_ext.c
CHANGED
@@ -339,7 +339,7 @@ static VALUE rb_yaji_each_iter(VALUE chunk, VALUE* params_p)
|
|
339
339
|
static VALUE rb_yaji_parser_each(int argc, VALUE* argv, VALUE self)
|
340
340
|
{
|
341
341
|
VALUE query, proc, params[3];
|
342
|
-
rb_scan_args(argc, argv, "
|
342
|
+
rb_scan_args(argc, argv, "01&", &query, &proc);
|
343
343
|
RETURN_ENUMERATOR(self, argc, argv);
|
344
344
|
params[0] = proc; // callback
|
345
345
|
params[1] = rb_ary_new(); // stack
|
data/lib/yaji/version.rb
CHANGED
data/test/test_parser.rb
CHANGED
@@ -96,7 +96,7 @@ class TestParser < MiniTest::Unit::TestCase
|
|
96
96
|
"movies" => [2,3]
|
97
97
|
}
|
98
98
|
]}]
|
99
|
-
|
99
|
+
assert_equal expected, objects
|
100
100
|
end
|
101
101
|
|
102
102
|
def test_it_yields_whole_array
|
@@ -115,7 +115,7 @@ class TestParser < MiniTest::Unit::TestCase
|
|
115
115
|
"props" => { "humanoid"=> true, "armed"=> false },
|
116
116
|
"movies" => [2,3]
|
117
117
|
}]]
|
118
|
-
|
118
|
+
assert_equal expected, objects
|
119
119
|
end
|
120
120
|
|
121
121
|
def test_it_yeilds_array_contents_row_by_row
|
@@ -134,7 +134,7 @@ class TestParser < MiniTest::Unit::TestCase
|
|
134
134
|
"props" => { "humanoid"=> true, "armed"=> false },
|
135
135
|
"movies" => [2,3]
|
136
136
|
}]
|
137
|
-
|
137
|
+
assert_equal expected, objects
|
138
138
|
end
|
139
139
|
|
140
140
|
def test_it_could_curb_async_approach
|
@@ -142,13 +142,13 @@ class TestParser < MiniTest::Unit::TestCase
|
|
142
142
|
parser = YAJI::Parser.new(curl)
|
143
143
|
object = parser.each.to_a.first
|
144
144
|
expected = {"foo"=>"bar", "baz"=>{"nums"=>[42, 3.1415]}}
|
145
|
-
|
145
|
+
assert_equal expected, object
|
146
146
|
end
|
147
147
|
|
148
148
|
def test_it_allow_several_selectors
|
149
149
|
parser = YAJI::Parser.new(toys_json_str)
|
150
150
|
objects = []
|
151
|
-
parser.each("total_rows", "rows/") do |o|
|
151
|
+
parser.each(["total_rows", "rows/"]) do |o|
|
152
152
|
objects << o
|
153
153
|
end
|
154
154
|
expected = [2,
|
@@ -162,7 +162,7 @@ class TestParser < MiniTest::Unit::TestCase
|
|
162
162
|
"props" => { "humanoid"=> true, "armed"=> false },
|
163
163
|
"movies" => [2,3]
|
164
164
|
}]
|
165
|
-
|
165
|
+
assert_equal expected, objects
|
166
166
|
end
|
167
167
|
|
168
168
|
protected
|
data/yaji.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yaji
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2011-08-22 00:00:00.000000000Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake-compiler
|
16
|
-
requirement: &
|
16
|
+
requirement: &12788740 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *12788740
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: minitest
|
27
|
-
requirement: &
|
27
|
+
requirement: &12788240 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *12788240
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: curb
|
38
|
-
requirement: &
|
38
|
+
requirement: &12787780 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,7 +43,18 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *12787780
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: ruby-debug19
|
49
|
+
requirement: &12787300 !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
type: :development
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: *12787300
|
47
58
|
description: YAJI is a ruby wrapper to YAJL providing iterator interface to streaming
|
48
59
|
JSON parser
|
49
60
|
email: info@couchbase.com
|
@@ -94,6 +105,4 @@ rubygems_version: 1.8.7
|
|
94
105
|
signing_key:
|
95
106
|
specification_version: 3
|
96
107
|
summary: Yet another JSON iterator
|
97
|
-
test_files:
|
98
|
-
- test/fixture.json
|
99
|
-
- test/test_parser.rb
|
108
|
+
test_files: []
|