Sha256: f65f8820dfef8b4eb615bd6436a1a76a672c6dc6bec24168207c1ee187107b14
Contents?: true
Size: 739 Bytes
Versions: 25
Compression:
Stored size: 739 Bytes
Contents
require 'oj' require 'multi_json/adapter' module MultiJson module Adapters # Use the Oj library to dump/load. class Oj < Adapter defaults :load, :mode => :strict, :symbolize_keys => false defaults :dump, :mode => :compat, :time_format => :ruby, :use_to_json => true ParseError = defined?(::Oj::ParseError) ? ::Oj::ParseError : SyntaxError def load(string, options={}) options[:symbol_keys] = options.delete(:symbolize_keys) ::Oj.load(string, options) end def dump(object, options={}) options.merge!(:indent => 2) if options[:pretty] options[:indent] = options[:indent].to_i if options[:indent] ::Oj.dump(object, options) end end end end
Version data entries
25 entries across 18 versions & 10 rubygems