Class: MultiJson::Adapters::OkJson
- Inherits:
-
MultiJson::Adapter
- Object
- MultiJson::Adapter
- MultiJson::Adapters::OkJson
- Includes:
- ConvertibleHashKeys
- Defined in:
- lib/multi_json/adapters/ok_json.rb
Direct Known Subclasses
Constant Summary collapse
- ParseError =
::MultiJson::OkJson::Error
Instance Attribute Summary
Attributes included from 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
17 18 19 |
# File 'lib/multi_json/adapters/ok_json.rb', line 17 def dump(object, ={}) ::MultiJson::OkJson.valenc(stringify_keys(object)) end |
#load(string, options = {}) ⇒ Object
11 12 13 14 15 |
# File 'lib/multi_json/adapters/ok_json.rb', line 11 def load(string, ={}) string = string.read if string.respond_to?(:read) result = ::MultiJson::OkJson.decode("[#{string}]").first [:symbolize_keys] ? symbolize_keys(result) : result end |