Class: MultiJson::Adapters::Gson

Inherits:
MultiJson::Adapter show all
Defined in:
lib/multi_json/adapters/gson.rb

Overview

Use the gson.rb library to dump/load.

Constant Summary collapse

ParseError =
::Gson::DecodeError

Instance Attribute Summary

Attributes included from Options

#dump_options, #load_options

Instance Method Summary collapse

Methods inherited from MultiJson::Adapter

activate!, defaults, dump, load

Methods included from Options

#default_dump_options, #default_load_options

Instance Method Details

#dump(object, options = {}) ⇒ Object



14
15
16
# File 'lib/multi_json/adapters/gson.rb', line 14

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

#load(string, options = {}) ⇒ Object



10
11
12
# File 'lib/multi_json/adapters/gson.rb', line 10

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