Class: YagniJsonEncoder
- Inherits:
-
Object
- Object
- YagniJsonEncoder
- Defined in:
- lib/yagni_json_encoder.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #encode(value) ⇒ Object
-
#initialize(options = nil) ⇒ YagniJsonEncoder
constructor
A new instance of YagniJsonEncoder.
Constructor Details
#initialize(options = nil) ⇒ YagniJsonEncoder
Returns a new instance of YagniJsonEncoder.
6 7 8 |
# File 'lib/yagni_json_encoder.rb', line 6 def initialize( = nil) @options = || {} end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
4 5 6 |
# File 'lib/yagni_json_encoder.rb', line 4 def @options end |
Instance Method Details
#encode(value) ⇒ Object
10 11 12 13 14 |
# File 'lib/yagni_json_encoder.rb', line 10 def encode(value) Oj.dump value.as_json(.dup), mode: :compat, quirks_mode: true end |