Class: ActionView::Helpers::JavaScriptVariableProxy
- Inherits:
-
JavaScriptProxy
- Object
- ActiveSupport::BasicObject
- JavaScriptProxy
- ActionView::Helpers::JavaScriptVariableProxy
- Defined in:
- lib/action_view/helpers/prototype_helper.rb
Overview
:nodoc:
Instance Method Summary collapse
-
#initialize(generator, variable) ⇒ JavaScriptVariableProxy
constructor
A new instance of JavaScriptVariableProxy.
-
#respond_to?(method) ⇒ Boolean
The JSON Encoder calls this to check for the
to_json
method Since it’s a blank slate object, I suppose it responds to anything. - #to_json(options = nil) ⇒ Object
Constructor Details
#initialize(generator, variable) ⇒ JavaScriptVariableProxy
Returns a new instance of JavaScriptVariableProxy.
1170 1171 1172 1173 1174 |
# File 'lib/action_view/helpers/prototype_helper.rb', line 1170 def initialize(generator, variable) @variable = variable @empty = true # only record lines if we have to. gets rid of unnecessary linebreaks super(generator) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class ActionView::Helpers::JavaScriptProxy
Instance Method Details
#respond_to?(method) ⇒ Boolean
The JSON Encoder calls this to check for the to_json
method Since it’s a blank slate object, I suppose it responds to anything.
1178 1179 1180 |
# File 'lib/action_view/helpers/prototype_helper.rb', line 1178 def respond_to?(method) true end |
#to_json(options = nil) ⇒ Object
1182 1183 1184 |
# File 'lib/action_view/helpers/prototype_helper.rb', line 1182 def to_json( = nil) @variable end |