Sha256: b4f0f4f91e6bcd3c2502bc7e84eaadb773a00a44c3a65bf2ea775f02f46af3d7

Contents?: true

Size: 454 Bytes

Versions: 6

Compression:

Stored size: 454 Bytes

Contents

require 'gson'
require 'multi_json/adapter'

module MultiJson
  module Adapters
    # Use the gson.rb library to dump/load.
    class Gson < Adapter
      ParseError = ::Gson::DecodeError

      def load(string, options={})
        string = string.read if StringIO === string
        ::Gson::Decoder.new(options).decode(string)
      end

      def dump(object, options={})
        ::Gson::Encoder.new(options).encode(object)
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
multi_json-1.10.0 lib/multi_json/adapters/gson.rb
multi_json-1.9.3 lib/multi_json/adapters/gson.rb
multi_json-1.9.2 lib/multi_json/adapters/gson.rb
multi_json-1.9.1 lib/multi_json/adapters/gson.rb
multi_json-1.9.0 lib/multi_json/adapters/gson.rb
multi_json-1.8.4 lib/multi_json/adapters/gson.rb