mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
be93ac50db
* ext/json/lib/json/pure/generator.rb (utf8_to_json): process as binary and remove Iconv dependency. * ext/json/lib/json/pure/parser.rb (parse_string): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19666 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
22 lines
579 B
Ruby
22 lines
579 B
Ruby
require 'json/common'
|
|
require 'json/pure/parser'
|
|
require 'json/pure/generator'
|
|
|
|
module JSON
|
|
# Swap consecutive bytes of _string_ in place.
|
|
def self.swap!(string) # :nodoc:
|
|
0.upto(string.size / 2) do |i|
|
|
break unless string[2 * i + 1]
|
|
string[2 * i], string[2 * i + 1] = string[2 * i + 1], string[2 * i]
|
|
end
|
|
string
|
|
end
|
|
|
|
# This module holds all the modules/classes that implement JSON's
|
|
# functionality in pure ruby.
|
|
module Pure
|
|
$DEBUG and warn "Using pure library for JSON."
|
|
JSON.parser = Parser
|
|
JSON.generator = Generator
|
|
end
|
|
end
|