Class: MultiJson::Adapter

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

Instance Attribute Summary

Attributes included from Options

#dump_options, #load_options

Class Method Summary collapse

Methods included from Options

default_dump_options, default_load_options

Class Method Details

.activate!Object


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

def activate!
  @load_options_cache = {}
  @dump_options_cache = {}
  instance.activate if instance.respond_to?(:activate)
end

.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


28
29
30
# File 'lib/multi_json/adapter.rb', line 28

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

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


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

def load(string, options={})
  instance.load(string, collect_load_options(string, options).clone)
end