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
- #as_json(options = nil) ⇒ Object
-
#initialize(generator, variable) ⇒ JavaScriptVariableProxy
constructor
A new instance of JavaScriptVariableProxy.
-
#respond_to? ⇒ 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.
Methods inherited from JavaScriptProxy
Constructor Details
#initialize(generator, variable) ⇒ JavaScriptVariableProxy
Returns a new instance of JavaScriptVariableProxy.
723 724 725 726 727 |
# File 'lib/action_view/helpers/prototype_helper.rb', line 723 def initialize(generator, variable) @variable = ::ActiveSupport::JSON::Variable.new(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
#as_json(options = nil) ⇒ Object
735 736 737 |
# File 'lib/action_view/helpers/prototype_helper.rb', line 735 def as_json( = nil) @variable end |
#respond_to? ⇒ 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.
731 732 733 |
# File 'lib/action_view/helpers/prototype_helper.rb', line 731 def respond_to?(*) true end |