Sha256: e552772b6292e27733be71dda3978f8e5f4d7c913ebeb70b3e3ff05e405c631a

Contents?: true

Size: 648 Bytes

Versions: 37

Compression:

Stored size: 648 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

      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

37 entries across 37 versions & 2 rubygems

Version Path
multi_json-1.9.1 lib/multi_json/adapters/oj.rb
multi_json-1.9.0 lib/multi_json/adapters/oj.rb
plyom_user-0.3.1 vendor/bundle/ruby/2.0.0/gems/multi_json-1.8.2/lib/multi_json/adapters/oj.rb
plyom_user-0.3.0 vendor/bundle/ruby/2.0.0/gems/multi_json-1.8.2/lib/multi_json/adapters/oj.rb
plyom_user-0.2.9 vendor/bundle/ruby/2.0.0/gems/multi_json-1.8.2/lib/multi_json/adapters/oj.rb
plyom_user-0.2.8 vendor/bundle/ruby/2.0.0/gems/multi_json-1.8.2/lib/multi_json/adapters/oj.rb
plyom_user-0.2.7 vendor/bundle/ruby/2.0.0/gems/multi_json-1.8.2/lib/multi_json/adapters/oj.rb
plyom_user-0.2.6 vendor/bundle/ruby/2.0.0/gems/multi_json-1.8.2/lib/multi_json/adapters/oj.rb
plyom_user-0.2.5 vendor/bundle/ruby/2.0.0/gems/multi_json-1.8.2/lib/multi_json/adapters/oj.rb
plyom_user-0.2.4 vendor/bundle/ruby/2.0.0/gems/multi_json-1.8.2/lib/multi_json/adapters/oj.rb
plyom_user-0.2.3 vendor/bundle/ruby/2.0.0/gems/multi_json-1.8.2/lib/multi_json/adapters/oj.rb
plyom_user-0.2.2 vendor/bundle/ruby/2.0.0/gems/multi_json-1.8.2/lib/multi_json/adapters/oj.rb
plyom_user-0.2.1 vendor/bundle/ruby/2.0.0/gems/multi_json-1.8.2/lib/multi_json/adapters/oj.rb
plyom_user-0.2.0 vendor/bundle/ruby/2.0.0/gems/multi_json-1.8.2/lib/multi_json/adapters/oj.rb
plyom_user-0.1.9 vendor/bundle/ruby/2.0.0/gems/multi_json-1.8.2/lib/multi_json/adapters/oj.rb
multi_json-1.8.4 lib/multi_json/adapters/oj.rb
multi_json-1.8.3 lib/multi_json/adapters/oj.rb
plyom_user-0.1.8 vendor/bundle/ruby/2.0.0/gems/multi_json-1.8.2/lib/multi_json/adapters/oj.rb
plyom_user-0.1.7 vendor/bundle/ruby/2.0.0/gems/multi_json-1.8.2/lib/multi_json/adapters/oj.rb
plyom_user-0.1.6 vendor/bundle/ruby/2.0.0/gems/multi_json-1.8.2/lib/multi_json/adapters/oj.rb