Class: MultiJson::Adapter

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

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

.defaults(action, value) ⇒ Object



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

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



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

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

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

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