Class: ActiveSupport::JSON::Encoding::JSONGemEncoder

Inherits:
Object
  • Object
show all
Defined in:
activesupport/lib/active_support/json/encoding.rb

Overview

:nodoc:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = nil) ⇒ JSONGemEncoder

Returns a new instance of JSONGemEncoder.


27
28
29
# File 'activesupport/lib/active_support/json/encoding.rb', line 27

def initialize(options = nil)
  @options = options || {}
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options


25
26
27
# File 'activesupport/lib/active_support/json/encoding.rb', line 25

def options
  @options
end

Instance Method Details

#encode(value) ⇒ Object

Encode the given object into a JSON string


32
33
34
# File 'activesupport/lib/active_support/json/encoding.rb', line 32

def encode(value)
  stringify jsonify value.as_json(options.dup)
end