Sha256: cdaa1a0dfc6303cf19c8b78f52a8cf5b9978288fd533a2a174659fbd13e5abaa

Contents?: true

Size: 670 Bytes

Versions: 46

Compression:

Stored size: 670 Bytes

Contents

require 'oj' unless defined?(::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

      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]
        ::Oj.dump(object, options)
      end
    end
  end
end

Version data entries

46 entries across 45 versions & 6 rubygems

Version Path
scout-5.9.13 vendor/multi_json/lib/multi_json/adapters/oj.rb
scout-5.9.12 vendor/multi_json/lib/multi_json/adapters/oj.rb
scout-5.9.11 vendor/multi_json/lib/multi_json/adapters/oj.rb
scout-5.9.10.pre vendor/multi_json/lib/multi_json/adapters/oj.rb
scout-5.9.8 vendor/multi_json/lib/multi_json/adapters/oj.rb
scout-5.9.7.2.pre vendor/multi_json/lib/multi_json/adapters/oj.rb
scout-5.9.8.pre vendor/multi_json/lib/multi_json/adapters/oj.rb
scout-5.9.7.1 vendor/multi_json/lib/multi_json/adapters/oj.rb
scout-5.9.7.pre vendor/multi_json/lib/multi_json/adapters/oj.rb
vagrant-tiktalik-0.0.3 vendor/bundle/ruby/2.0.0/gems/multi_json-1.7.9/lib/multi_json/adapters/oj.rb
scout-5.9.5 vendor/multi_json/lib/multi_json/adapters/oj.rb
scout-5.9.4 vendor/multi_json/lib/multi_json/adapters/oj.rb
scout-5.9.4.pre vendor/multi_json/lib/multi_json/adapters/oj.rb
scout-5.9.3 vendor/multi_json/lib/multi_json/adapters/oj.rb
scout-5.9.2 vendor/multi_json/lib/multi_json/adapters/oj.rb
scout-5.9.1 vendor/multi_json/lib/multi_json/adapters/oj.rb
scout-5.9.1.pre vendor/multi_json/lib/multi_json/adapters/oj.rb
scout-5.9.0 vendor/multi_json/lib/multi_json/adapters/oj.rb
scout-5.9.0.pre vendor/multi_json/lib/multi_json/adapters/oj.rb
scout-5.8.9 vendor/multi_json/lib/multi_json/adapters/oj.rb