Class: Sensu::JSON::Oj
- Inherits:
-
Object
- Object
- Sensu::JSON::Oj
- Defined in:
- lib/sensu/json/oj.rb
Overview
The Sensu JSON parser when running on MRI.
Instance Method Summary collapse
-
#dump(object, options = {}) ⇒ Object
Dump (generate) a JSON string from a Ruby object.
-
#load(string) ⇒ Object
Load (and parse) a JSON string.
Instance Method Details
#dump(object, options = {}) ⇒ Object
Dump (generate) a JSON string from a Ruby object.
23 24 25 26 |
# File 'lib/sensu/json/oj.rb', line 23 def dump(object, ={}) .merge!(:indent => 2) if [:pretty] ::Oj.dump(object, ) end |
#load(string) ⇒ Object
Load (and parse) a JSON string. Sensu expects symbolized keys.
15 16 17 |
# File 'lib/sensu/json/oj.rb', line 15 def load(string) ::Oj.load(string, :symbol_keys => true) end |