Methods
A
E
N
O
Attributes
[R] options
Class Public methods
new(options = nil)
    # File activesupport/lib/active_support/json/encoding.rb, line 40
40:         def initialize(options = nil)
41:           @options = options || {}
42:           @seen = Set.new
43:         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
53:         def as_json(value, use_options = true)
54:           check_for_circular_references(value) do
55:             use_options ? value.as_json(options_for(value)) : value.as_json
56:           end
57:         end
encode(value, use_options = true)
    # File activesupport/lib/active_support/json/encoding.rb, line 45
45:         def encode(value, use_options = true)
46:           check_for_circular_references(value) do
47:             jsonified = use_options ? value.as_json(options_for(value)) : value.as_json
48:             jsonified.encode_json(self)
49:           end
50:         end
escape(string)
    # File activesupport/lib/active_support/json/encoding.rb, line 68
68:         def escape(string)
69:           Encoding.escape(string)
70:         end
options_for(value)
    # File activesupport/lib/active_support/json/encoding.rb, line 59
59:         def options_for(value)
60:           if value.is_a?(Array) || value.is_a?(Hash)
61:             # hashes and arrays need to get encoder in the options, so that they can detect circular references
62:             options.merge(:encoder => self)
63:           else
64:             options
65:           end
66:         end