yajl-ruby 0.5.9 → 0.5.10

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of yajl-ruby might be problematic. Click here for more details.

data/CHANGELOG.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.5.10 (July 13th, 2009)
4
+ * Bugfix for the JSON gem compatibility API's default Object#to_json helper
5
+
3
6
  ## 0.5.9 (July 9th, 2009)
4
7
  * Bugfix for Yajl::Encoder where encoding a hash like {:a => :b} would get stuck in an infinite loop
5
8
 
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
- :patch: 9
2
+ :patch: 10
3
3
  :major: 0
4
4
  :minor: 5
data/ext/yajl_ext.c CHANGED
@@ -136,10 +136,6 @@ void yajl_encode_part(void * wrapper, VALUE obj, VALUE io) {
136
136
  case T_STRING:
137
137
  status = yajl_gen_string(w->encoder, (const unsigned char *)RSTRING_PTR(obj), (unsigned int)RSTRING_LEN(obj));
138
138
  break;
139
- case T_SYMBOL:
140
- str = rb_funcall(obj, intern_to_s, 0);
141
- status = yajl_gen_string(w->encoder, (const unsigned char *)RSTRING_PTR(str), (unsigned int)RSTRING_LEN(str));
142
- break;
143
139
  default:
144
140
  if (rb_respond_to(obj, intern_to_json)) {
145
141
  str = rb_funcall(obj, intern_to_json, 0);
@@ -584,7 +580,8 @@ static VALUE rb_yajl_json_ext_object_to_json(int argc, VALUE * argv, VALUE self)
584
580
  if (rb_encoder == Qnil) {
585
581
  rb_encoder = rb_yajl_encoder_new(0, NULL, cEncoder);
586
582
  }
587
- return rb_yajl_encoder_encode(1, &self, rb_encoder);
583
+ VALUE str = rb_funcall(self, intern_to_s, 0);
584
+ return rb_yajl_encoder_encode(1, &str, rb_encoder);
588
585
  }
589
586
 
590
587
  /*
data/lib/yajl.rb CHANGED
@@ -13,7 +13,7 @@ require 'yajl_ext'
13
13
  #
14
14
  # Ruby bindings to the excellent Yajl (Yet Another JSON Parser) ANSI C library.
15
15
  module Yajl
16
- VERSION = "0.5.9"
16
+ VERSION = "0.5.10"
17
17
 
18
18
  class Parser
19
19
  # A helper method for parse-and-forget use-cases
@@ -53,6 +53,20 @@ describe "JSON Gem compatability API" do
53
53
  JSON.default_options[:symbolize_keys] = default # ensure the rest of the test cases expect the default
54
54
  end
55
55
 
56
+ it "should encode arbitrary classes via their default to_json method" do
57
+ d = Dummy.new
58
+ d.to_json.should == "\"#{d.to_s}\""
59
+
60
+ t = Time.now
61
+ t.to_json.should == "\"#{t.to_s}\""
62
+
63
+ da = Date.today
64
+ da.to_json.should == "\"#{da.to_s}\""
65
+
66
+ dt = DateTime.new
67
+ dt.to_json.should == "\"#{dt.to_s}\""
68
+ end
69
+
56
70
  context "ported tests for Unicode" do
57
71
  it "should be able to encode and parse unicode" do
58
72
  pending if RUBY_VERSION.include?('1.9') # FIXME: Some string encoding problem with 1.9
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.5.9"
5
+ s.version = "0.5.10"
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-07-09}
9
+ s.date = %q{2009-07-13}
10
10
  s.email = %q{seniorlopez@gmail.com}
11
11
  s.extensions = ["ext/extconf.rb"]
12
12
  s.extra_rdoc_files = [
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yajl-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.9
4
+ version: 0.5.10
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-07-09 00:00:00 -07:00
13
+ date: 2009-07-13 00:00:00 -07:00
14
14
  default_executable:
15
15
  dependencies: []
16
16