Module: ActiveSupport::JS

Defined in:
lib/to-javascript/code.rb,
lib/to-javascript/encoding.rb

Defined Under Namespace

Classes: CircularReferenceError, Code

Constant Summary collapse

REFERENCE_STACK_VARIABLE =

:nodoc:

:json_reference_stack

Class Method Summary collapse

Class Method Details

.encode(value, options = {}) ⇒ Object

Converts a Ruby object into a Javascript string.



19
20
21
22
23
# File 'lib/to-javascript/encoding.rb', line 19

def encode(value, options = {})
  raise_on_circular_reference(value) do
    value.send(:to_js, options)
  end
end