Class: ActiveSupport::JSON::Encoding::JSONGemEncoder
- Defined in:
- lib/active_support/json/encoding.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
-
#encode(value) ⇒ Object
Encode the given object into a JSON string.
-
#initialize(options = nil) ⇒ JSONGemEncoder
constructor
A new instance of JSONGemEncoder.
Constructor Details
#initialize(options = nil) ⇒ JSONGemEncoder
Returns a new instance of JSONGemEncoder.
27 28 29 |
# File 'lib/active_support/json/encoding.rb', line 27 def initialize( = nil) @options = || {} end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
25 26 27 |
# File 'lib/active_support/json/encoding.rb', line 25 def @options end |
Instance Method Details
#encode(value) ⇒ Object
Encode the given object into a JSON string
32 33 34 |
# File 'lib/active_support/json/encoding.rb', line 32 def encode(value) stringify jsonify value.as_json(.dup) end |