All Downloads are FREE. Search and download functionalities are using the official Maven repository.

gems.multi_json-1.11.2.lib.multi_json.adapters.jr_jackson.rb Maven / Gradle / Ivy

There is a newer version: 3.7.2
Show newest version
require 'jrjackson' unless defined?(::JrJackson)
require 'multi_json/adapter'

module MultiJson
  module Adapters
    # Use the jrjackson.rb library to dump/load.
    class JrJackson < Adapter
      ParseError = ::JrJackson::ParseError

      def load(string, options={}) #:nodoc:
        ::JrJackson::Json.load(string, options)
      end

      if ::JrJackson::Json.method(:dump).arity == 1
        def dump(object, _)
          ::JrJackson::Json.dump(object)
        end
      else
        def dump(object, options={})
          ::JrJackson::Json.dump(object, options)
        end
      end
    end
  end
end




© 2015 - 2025 Weber Informatics LLC | Privacy Policy