Class: NOSJ::MultiJsonAdapter
- Inherits:
-
Object
- Object
- NOSJ::MultiJsonAdapter
- Defined in:
- lib/nosj/multi_json.rb,
sig/nosj.rbs
Overview
Defined by require "nosj/multi_json". The runtime superclass is
multi_json's Adapter (whose namespace differs across multi_json
versions), so it is not declared here.
Constant Summary collapse
- ParseError =
multi_json wraps whatever the adapter's ParseError names.
::JSON::ParserError
Instance Method Summary collapse
-
#dump(object, options = {}) ⇒ String
The JSON document.
-
#load(string, options = {}) ⇒ Object
The parsed value tree.
Instance Method Details
#dump(object, options = {}) ⇒ String
Returns the JSON document.
47 48 49 |
# File 'lib/nosj/multi_json.rb', line 47 def dump(object, = {}) [:pretty] ? ::NOSJ.pretty_generate(object) : ::NOSJ.generate(object) end |
#load(string, options = {}) ⇒ Object
Returns the parsed value tree.
37 38 39 40 41 |
# File 'lib/nosj/multi_json.rb', line 37 def load(string, = {}) ::NOSJ.parse(string, [:symbolize_names] ? SYMBOLIZE : nil) rescue RuntimeError => e raise ParseError, e. end |