Jack Nagel 997f9d0075 Update multi_json to 1.5.0
This contains updates to the OkJson library that allow objects to define
to_json for serialization, and this will be used in the upcoming options
and deps work.
2013-01-17 21:39:43 -06:00

27 lines
617 B
Ruby

require 'oj' unless defined?(::Oj)
module MultiJson
module Adapters
# Use the Oj library to dump/load.
class Oj
ParseError = if defined?(::Oj::ParseError)
::Oj::ParseError
else
SyntaxError
end
::Oj.default_options = {:mode => :compat}
def self.load(string, options={}) #:nodoc:
options.merge!(:symbol_keys => options[:symbolize_keys])
::Oj.load(string, options)
end
def self.dump(object, options={}) #:nodoc:
options.merge!(:indent => 2) if options[:pretty]
::Oj.dump(object, options)
end
end
end
end