brianmario-yajl-ruby 0.4.8 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. data/CHANGELOG.rdoc +21 -0
  2. data/README.rdoc +13 -0
  3. data/VERSION.yml +2 -2
  4. data/benchmark/encode.rb +4 -3
  5. data/benchmark/encode_json_and_marshal.rb +4 -3
  6. data/benchmark/encode_json_and_yaml.rb +4 -3
  7. data/benchmark/parse.rb +5 -4
  8. data/benchmark/parse_json_and_marshal.rb +4 -3
  9. data/benchmark/parse_json_and_yaml.rb +4 -3
  10. data/benchmark/parse_stream.rb +48 -0
  11. data/benchmark/subjects/twitter_stream.json +430 -0
  12. data/examples/http/twitter_search_api.rb +15 -0
  13. data/examples/http/twitter_stream_api.rb +24 -0
  14. data/examples/parsing/from_file.rb +14 -0
  15. data/examples/parsing/from_stdin.rb +9 -0
  16. data/examples/parsing/from_string.rb +15 -0
  17. data/ext/api/yajl_parse.h +3 -0
  18. data/ext/extconf.rb +2 -1
  19. data/ext/yajl.c +5 -0
  20. data/ext/yajl_ext.c +235 -122
  21. data/ext/yajl_ext.h +49 -36
  22. data/ext/yajl_lex.c +7 -0
  23. data/ext/yajl_lex.h +2 -0
  24. data/ext/yajl_parser.c +3 -1
  25. data/lib/yajl.rb +18 -17
  26. data/lib/yajl/bzip2.rb +1 -1
  27. data/lib/yajl/bzip2/stream_reader.rb +1 -1
  28. data/lib/yajl/bzip2/stream_writer.rb +1 -1
  29. data/lib/yajl/deflate.rb +1 -1
  30. data/lib/yajl/deflate/stream_reader.rb +1 -1
  31. data/lib/yajl/deflate/stream_writer.rb +1 -1
  32. data/lib/yajl/gzip.rb +1 -1
  33. data/lib/yajl/gzip/stream_reader.rb +1 -1
  34. data/lib/yajl/gzip/stream_writer.rb +1 -1
  35. data/lib/yajl/http_stream.rb +21 -5
  36. data/spec/encoding/encoding_spec.rb +14 -9
  37. data/spec/http/http_spec.rb +1 -5
  38. data/spec/parsing/active_support_spec.rb +5 -3
  39. data/spec/parsing/chunked_spec.rb +72 -0
  40. data/spec/parsing/fixtures_spec.rb +4 -2
  41. data/spec/parsing/one_off_spec.rb +2 -1
  42. data/spec/spec_helper.rb +8 -1
  43. data/yajl-ruby.gemspec +17 -3
  44. metadata +16 -2
@@ -10,7 +10,8 @@ describe "Parsing JSON Fixtures" do
10
10
  FAILED.each do |name, source|
11
11
  it "should not be able to parse #{File.basename(name)}" do
12
12
  lambda {
13
- Yajl::Stream.parse(StringIO.new(source))
13
+ parser = Yajl::Parser.new
14
+ parser.parse(StringIO.new(source))
14
15
  }.should raise_error(Yajl::ParseError)
15
16
  end
16
17
  end
@@ -18,7 +19,8 @@ describe "Parsing JSON Fixtures" do
18
19
  PASSED.each do |name, source|
19
20
  it "should be able to parse #{File.basename(name)}" do
20
21
  lambda {
21
- Yajl::Stream.parse(StringIO.new(source))
22
+ parser = Yajl::Parser.new
23
+ parser.parse(StringIO.new(source))
22
24
  }.should_not raise_error(Yajl::ParseError)
23
25
  end
24
26
  end
@@ -5,7 +5,8 @@ describe "One-off JSON examples" do
5
5
  it "should parse 23456789012E666 and return Infinity" do
6
6
  infinity = (1.0/0)
7
7
  silence_warnings do
8
- Yajl::Stream.parse(StringIO.new('{"key": 23456789012E666}')).should == {"key" => infinity}
8
+ parser = Yajl::Parser.new
9
+ parser.parse(StringIO.new('{"key": 23456789012E666}')).should == {"key" => infinity}
9
10
  end
10
11
  end
11
12
  end
data/spec/spec_helper.rb CHANGED
@@ -1,4 +1,11 @@
1
1
  # encoding: UTF-8
2
- require 'yajl'
2
+ $LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib')
3
+
4
+ begin
5
+ require './yajl_ext'
6
+ require 'yajl'
7
+ rescue LoadError
8
+ require 'yajl'
9
+ end
3
10
  require 'stringio'
4
11
  require 'active_support/core_ext/kernel/reporting'
data/yajl-ruby.gemspec CHANGED
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{yajl-ruby}
5
- s.version = "0.4.8"
5
+ s.version = "0.5.0"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Brian Lopez", "Lloyd Hilaiel"]
9
- s.date = %q{2009-05-18}
9
+ s.date = %q{2009-05-25}
10
10
  s.email = %q{seniorlopez@gmail.com}
11
11
  s.extensions = ["ext/extconf.rb"]
12
12
  s.extra_rdoc_files = [
@@ -27,12 +27,19 @@ Gem::Specification.new do |s|
27
27
  "benchmark/parse.rb",
28
28
  "benchmark/parse_json_and_marshal.rb",
29
29
  "benchmark/parse_json_and_yaml.rb",
30
+ "benchmark/parse_stream.rb",
30
31
  "benchmark/subjects/contacts.json",
31
32
  "benchmark/subjects/contacts.yml",
32
33
  "benchmark/subjects/item.json",
33
34
  "benchmark/subjects/ohai.json",
34
35
  "benchmark/subjects/twitter_search.json",
36
+ "benchmark/subjects/twitter_stream.json",
35
37
  "benchmark/subjects/unicode.json",
38
+ "examples/http/twitter_search_api.rb",
39
+ "examples/http/twitter_stream_api.rb",
40
+ "examples/parsing/from_file.rb",
41
+ "examples/parsing/from_stdin.rb",
42
+ "examples/parsing/from_string.rb",
36
43
  "ext/api/yajl_common.h",
37
44
  "ext/api/yajl_gen.h",
38
45
  "ext/api/yajl_parse.h",
@@ -70,6 +77,7 @@ Gem::Specification.new do |s|
70
77
  "spec/http/fixtures/http.raw.dump",
71
78
  "spec/http/http_spec.rb",
72
79
  "spec/parsing/active_support_spec.rb",
80
+ "spec/parsing/chunked_spec.rb",
73
81
  "spec/parsing/fixtures/fail.15.json",
74
82
  "spec/parsing/fixtures/fail.16.json",
75
83
  "spec/parsing/fixtures/fail.17.json",
@@ -141,9 +149,15 @@ Gem::Specification.new do |s|
141
149
  "spec/encoding/encoding_spec.rb",
142
150
  "spec/http/http_spec.rb",
143
151
  "spec/parsing/active_support_spec.rb",
152
+ "spec/parsing/chunked_spec.rb",
144
153
  "spec/parsing/fixtures_spec.rb",
145
154
  "spec/parsing/one_off_spec.rb",
146
- "spec/spec_helper.rb"
155
+ "spec/spec_helper.rb",
156
+ "examples/http/twitter_search_api.rb",
157
+ "examples/http/twitter_stream_api.rb",
158
+ "examples/parsing/from_file.rb",
159
+ "examples/parsing/from_stdin.rb",
160
+ "examples/parsing/from_string.rb"
147
161
  ]
148
162
 
149
163
  if s.respond_to? :specification_version then
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: brianmario-yajl-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.8
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Lopez
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2009-05-18 00:00:00 -07:00
13
+ date: 2009-05-25 00:00:00 -07:00
14
14
  default_executable:
15
15
  dependencies: []
16
16
 
@@ -37,12 +37,19 @@ files:
37
37
  - benchmark/parse.rb
38
38
  - benchmark/parse_json_and_marshal.rb
39
39
  - benchmark/parse_json_and_yaml.rb
40
+ - benchmark/parse_stream.rb
40
41
  - benchmark/subjects/contacts.json
41
42
  - benchmark/subjects/contacts.yml
42
43
  - benchmark/subjects/item.json
43
44
  - benchmark/subjects/ohai.json
44
45
  - benchmark/subjects/twitter_search.json
46
+ - benchmark/subjects/twitter_stream.json
45
47
  - benchmark/subjects/unicode.json
48
+ - examples/http/twitter_search_api.rb
49
+ - examples/http/twitter_stream_api.rb
50
+ - examples/parsing/from_file.rb
51
+ - examples/parsing/from_stdin.rb
52
+ - examples/parsing/from_string.rb
46
53
  - ext/api/yajl_common.h
47
54
  - ext/api/yajl_gen.h
48
55
  - ext/api/yajl_parse.h
@@ -80,6 +87,7 @@ files:
80
87
  - spec/http/fixtures/http.raw.dump
81
88
  - spec/http/http_spec.rb
82
89
  - spec/parsing/active_support_spec.rb
90
+ - spec/parsing/chunked_spec.rb
83
91
  - spec/parsing/fixtures/fail.15.json
84
92
  - spec/parsing/fixtures/fail.16.json
85
93
  - spec/parsing/fixtures/fail.17.json
@@ -172,6 +180,12 @@ test_files:
172
180
  - spec/encoding/encoding_spec.rb
173
181
  - spec/http/http_spec.rb
174
182
  - spec/parsing/active_support_spec.rb
183
+ - spec/parsing/chunked_spec.rb
175
184
  - spec/parsing/fixtures_spec.rb
176
185
  - spec/parsing/one_off_spec.rb
177
186
  - spec/spec_helper.rb
187
+ - examples/http/twitter_search_api.rb
188
+ - examples/http/twitter_stream_api.rb
189
+ - examples/parsing/from_file.rb
190
+ - examples/parsing/from_stdin.rb
191
+ - examples/parsing/from_string.rb