Methods
A
E
N
O
Attributes
[R] options
Class Public methods
new(options = nil)
# File activesupport/lib/active_support/json/encoding.rb, line 40
def initialize(options = nil)
  @options = options || {}
  @seen = Set.new
end
Instance Public methods
as_json(value, use_options = true)

like encode, but only calls #as_json, without encoding to string

# File activesupport/lib/active_support/json/encoding.rb, line 53
def as_json(value, use_options = true)
  check_for_circular_references(value) do
    use_options ? value.as_json(options_for(value)) : value.as_json
  end
end
encode(value, use_options = true)
# File activesupport/lib/active_support/json/encoding.rb, line 45
def encode(value, use_options = true)
  check_for_circular_references(value) do
    jsonified = use_options ? value.as_json(options_for(value)) : value.as_json
    jsonified.encode_json(self)
  end
end
escape(string)
# File activesupport/lib/active_support/json/encoding.rb, line 68
def escape(string)
  Encoding.escape(string)
end
options_for(value)
# File activesupport/lib/active_support/json/encoding.rb, line 59
def options_for(value)
  if value.is_a?(Array) || value.is_a?(Hash)
    # hashes and arrays need to get encoder in the options, so that they can detect circular references
    options.merge(:encoder => self)
  else
    options
  end
end