mirror of
https://github.com/ruby/ruby.git
synced 2025-09-23 20:44:00 +02:00
* 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:
parent
395d7bb346
commit
43f6fdfb42
12 changed files with 84 additions and 32 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue