ruby-changes:21094
From: naruse <ko1@a...>
Date: Wed, 31 Aug 2011 16:03:04 +0900 (JST)
Subject: [ruby-changes:21094] naruse:r33143 (ruby_1_9_3): merge revision(s) 33142:
naruse 2011-08-31 16:02:52 +0900 (Wed, 31 Aug 2011) New Revision: 33143 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=33143 Log: merge revision(s) 33142: * ext/json: Merge json gem v1.5.4 (3dab4c5a6a97fac03dac). Added files: branches/ruby_1_9_3/ext/json/lib/json/add/complex.rb branches/ruby_1_9_3/ext/json/lib/json/add/rational.rb Modified files: branches/ruby_1_9_3/ChangeLog branches/ruby_1_9_3/NEWS branches/ruby_1_9_3/ext/json/generator/generator.c branches/ruby_1_9_3/ext/json/lib/json/add/core.rb branches/ruby_1_9_3/ext/json/parser/parser.c branches/ruby_1_9_3/test/json/test_json_addition.rb Index: ruby_1_9_3/ChangeLog =================================================================== --- ruby_1_9_3/ChangeLog (revision 33142) +++ ruby_1_9_3/ChangeLog (revision 33143) @@ -1,3 +1,7 @@ +Wed Aug 31 16:02:45 2011 NARUSE, Yui <naruse@r...> + + * ext/json: Merge json gem v1.5.4 (3dab4c5a6a97fac03dac). + Wed Aug 31 13:19:31 2011 Marc-Andre Lafortune <ruby-core@m...> * numeric.c (flo_round): Avoid overflow by optimizing for trivial Index: ruby_1_9_3/ext/json/generator/generator.c =================================================================== --- ruby_1_9_3/ext/json/generator/generator.c (revision 33142) +++ ruby_1_9_3/ext/json/generator/generator.c (revision 33143) @@ -1001,6 +1001,8 @@ * * *allow_nan*: true if NaN, Infinity, and -Infinity should be * generated, otherwise an exception is thrown, if these values are * encountered. This options defaults to false. + * * *quirks_mode*: Enables quirks_mode for parser, that is for example + * generating single JSON values instead of documents is possible. */ static VALUE cState_initialize(int argc, VALUE *argv, VALUE self) { Index: ruby_1_9_3/ext/json/lib/json/add/complex.rb =================================================================== --- ruby_1_9_3/ext/json/lib/json/add/complex.rb (revision 0) +++ ruby_1_9_3/ext/json/lib/json/add/complex.rb (revision 33143) @@ -0,0 +1,22 @@ +unless defined?(::JSON::JSON_LOADED) and ::JSON::JSON_LOADED + require 'json' +end +defined?(::Complex) or require 'complex' + +class Complex + def self.json_create(object) + Complex(object['r'], object['i']) + end + + def as_json(*) + { + JSON.create_id => self.class.name, + 'r' => real, + 'i' => imag, + } + end + + def to_json(*) + as_json.to_json + end +end Index: ruby_1_9_3/ext/json/lib/json/add/core.rb =================================================================== --- ruby_1_9_3/ext/json/lib/json/add/core.rb (revision 33142) +++ ruby_1_9_3/ext/json/lib/json/add/core.rb (revision 33143) @@ -241,39 +241,3 @@ as_json.to_json end end - -class Rational - def self.json_create(object) - Rational(object['n'], object['d']) - end - - def as_json(*) - { - JSON.create_id => self.class.name, - 'n' => numerator, - 'd' => denominator, - } - end - - def to_json(*) - as_json.to_json - end -end - -class Complex - def self.json_create(object) - Complex(object['r'], object['i']) - end - - def as_json(*) - { - JSON.create_id => self.class.name, - 'r' => real, - 'i' => imag, - } - end - - def to_json(*) - as_json.to_json - end -end Index: ruby_1_9_3/ext/json/lib/json/add/rational.rb =================================================================== --- ruby_1_9_3/ext/json/lib/json/add/rational.rb (revision 0) +++ ruby_1_9_3/ext/json/lib/json/add/rational.rb (revision 33143) @@ -0,0 +1,22 @@ +unless defined?(::JSON::JSON_LOADED) and ::JSON::JSON_LOADED + require 'json' +end +defined?(::Rational) or require 'rational' + +class Rational + def self.json_create(object) + Rational(object['n'], object['d']) + end + + def as_json(*) + { + JSON.create_id => self.class.name, + 'n' => numerator, + 'd' => denominator, + } + end + + def to_json(*) + as_json.to_json + end +end Index: ruby_1_9_3/ext/json/parser/parser.c =================================================================== --- ruby_1_9_3/ext/json/parser/parser.c (revision 33142) +++ ruby_1_9_3/ext/json/parser/parser.c (revision 33143) @@ -1618,6 +1618,9 @@ * defaults to true. * * *object_class*: Defaults to Hash * * *array_class*: Defaults to Array + * * *quirks_mode*: Enables quirks_mode for parser, that is for example + * parsing single JSON values instead of documents is possible. + * */ static VALUE cParser_initialize(int argc, VALUE *argv, VALUE self) { Index: ruby_1_9_3/NEWS =================================================================== --- ruby_1_9_3/NEWS (revision 33142) +++ ruby_1_9_3/NEWS (revision 33143) @@ -182,6 +182,9 @@ * IO#winsize * IO.console +* json + * updated to v1.5.4. + * matrix * new classes: * Matrix::EigenvalueDecomposition Index: ruby_1_9_3/test/json/test_json_addition.rb =================================================================== --- ruby_1_9_3/test/json/test_json_addition.rb (revision 33142) +++ ruby_1_9_3/test/json/test_json_addition.rb (revision 33143) @@ -3,7 +3,7 @@ require 'test/unit' require File.join(File.dirname(__FILE__), 'setup_variant') -load 'json/add/core.rb' +require 'json/add/core.rb' require 'date' class TC_JSONAddition < Test::Unit::TestCase -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/