Class: MultiJson::Adapters::OkJson
Constant Summary
collapse
- ParseError =
::MultiJson::OkJson::Error
Instance Method Summary
collapse
defaults, dump, load
Methods included from Options
#default_dump_options, #default_load_options, #dump_options, #dump_options=, #load_options, #load_options=
Instance Method Details
#dump(object, _ = {}) ⇒ Object
18
19
20
|
# File 'lib/multi_json/adapters/ok_json.rb', line 18
def dump(object, _ = {})
::MultiJson::OkJson.valenc(stringify_keys(object))
end
|
#load(string, options = {}) ⇒ Object
11
12
13
14
15
16
|
# File 'lib/multi_json/adapters/ok_json.rb', line 11
def load(string, options = {})
result = ::MultiJson::OkJson.decode("[#{string}]").first
options[:symbolize_keys] ? symbolize_keys(result) : result
rescue ArgumentError raise ParseError
end
|