Parent

Class Index [+]

Quicksearch

ActiveSupport::JSON::Encoding::Encoder

Attributes

options[R]

Public Class Methods

new(options = nil) click to toggle source
    # File lib/active_support/json/encoding.rb, line 39
39:         def initialize(options = nil)
40:           @options = options
41:           @seen = []
42:         end

Public Instance Methods

encode(value) click to toggle source
    # File lib/active_support/json/encoding.rb, line 44
44:         def encode(value)
45:           check_for_circular_references(value) do
46:             value.as_json(options).encode_json(self)
47:           end
48:         end
escape(string) click to toggle source
    # File lib/active_support/json/encoding.rb, line 50
50:         def escape(string)
51:           Encoding.escape(string)
52:         end

Private Instance Methods

check_for_circular_references(value) click to toggle source
    # File lib/active_support/json/encoding.rb, line 55
55:           def check_for_circular_references(value)
56:             if @seen.any? { |object| object.equal?(value) }
57:               raise CircularReferenceError, 'object references itself'
58:             end
59:             @seen.unshift value
60:             yield
61:           ensure
62:             @seen.shift
63:           end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.