Class: String
Direct Known Subclasses
Instance Method Summary collapse
-
#as_js ⇒ Object
Synonymous with Javascript(‘string’) Returns an unquoted Javascript object that will not be quoted when renderded as javasctipy.
-
#to_js(options = nil) ⇒ Object
:nodoc:.
Instance Method Details
#as_js ⇒ Object
Synonymous with Javascript(‘string’) Returns an unquoted Javascript object that will not be quoted when renderded as javasctipy
datecode = 'new Date()'.to_javascript
{ :now => datecode }.to_js
# => { "now": new Date() }
{ :location => 'window.location'.as_js }.to_js
# => {"location": window.location}
16 17 18 |
# File 'lib/to-javascript/encoders/string.rb', line 16 def as_js ActiveSupport::JS::Code.new self end |
#to_js(options = nil) ⇒ Object
:nodoc:
2 3 4 |
# File 'lib/to-javascript/encoders/string.rb', line 2 def to_js( = nil) #:nodoc: ActiveSupport::JS::Code.new to_json() end |