Class: Array

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

Instance Method Summary collapse

Instance Method Details

#as_json(options = nil) ⇒ Object

:nodoc:



169
170
171
172
173
# File 'lib/active_support/json/encoding/active_support_encoder.rb', line 169

def as_json(options = nil) #:nodoc:
  # use encoder as a proxy to call as_json on all elements, to protect from circular references
  encoder = options && options[:encoder] || ActiveSupport::JSON::Encoding::ActiveSupportEncoder.new(options)
  map { |v| encoder.as_json(v, options) }
end

#encode_json(encoder) ⇒ Object

:nodoc:



175
176
177
# File 'lib/active_support/json/encoding/active_support_encoder.rb', line 175

def encode_json(encoder) #:nodoc:
  "[#{map { |v| encoder.encode(v, false) } * ','}]"
end