* ext/json: merge JSON 1.7.5.

fix tests and other fixes.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38346 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
naruse 2012-12-12 10:51:49 +00:00
parent 395d7bb346
commit 43f6fdfb42
12 changed files with 84 additions and 32 deletions

View file

@ -103,7 +103,13 @@ module JSON
MinusInfinity = -Infinity
# The base exception for JSON errors.
class JSONError < StandardError; end
class JSONError < StandardError
def self.wrap(exception)
obj = new("Wrapped(#{exception.class}): #{exception.message.inspect}")
obj.set_backtrace exception.backtrace
obj
end
end
# This exception is raised if a parser error occurs.
class ParserError < JSONError; end
@ -399,7 +405,10 @@ module JSON
end
# Shortuct for iconv.
if ::String.method_defined?(:encode)
if ::String.method_defined?(:encode) &&
# XXX Rubinius doesn't support ruby 1.9 encoding yet
defined?(RUBY_ENGINE) && RUBY_ENGINE != 'rbx'
then
# Encodes string using Ruby's _String.encode_
def self.iconv(to, from, string)
string.encode(to, from)