Class: MultiJson::Adapter

Inherits:
Object
  • Object
show all
Extended by:
Options
Includes:
Singleton
Defined in:
lib/multi_json/adapter.rb

Direct Known Subclasses

MultiJson::Adapters::Gson, MultiJson::Adapters::JrJackson, MultiJson::Adapters::JsonCommon, MultiJson::Adapters::Oj, MultiJson::Adapters::OkJson, MultiJson::Adapters::Yajl

Class Method Summary (collapse)

Methods included from Options

default_dump_options, default_load_options, dump_options, dump_options=, load_options, load_options=

Class Method Details

+ (Object) defaults(action, value)



10
11
12
13
14
15
16
# File 'lib/multi_json/adapter.rb', line 10

def defaults(action, value)
  metaclass = class << self; self; end

  metaclass.instance_eval do
    define_method("default_#{action}_options"){ value }
  end
end

+ (Object) dump(object, options = {})



23
24
25
# File 'lib/multi_json/adapter.rb', line 23

def dump(object, options={})
  instance.dump(object, collect_dump_options(options).clone)
end

+ (Object) load(string, options = {})

Raises:

  • (self::ParseError)


18
19
20
21
# File 'lib/multi_json/adapter.rb', line 18

def load(string, options={})
  raise self::ParseError if blank?(string)
  instance.load(string, collect_load_options(options).clone)
end