Class: Mjs::JavaScriptVariableProxy
- Inherits:
-
JavaScriptProxy
- Object
- JavaScriptProxy
- Mjs::JavaScriptVariableProxy
- Defined in:
- lib/mjs/java_script_context.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.
463 464 465 466 467 |
# File 'lib/mjs/java_script_context.rb', line 463 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 Mjs::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.
471 472 473 |
# File 'lib/mjs/java_script_context.rb', line 471 def respond_to?(method) true end |
#to_json(options = nil) ⇒ Object
475 476 477 |
# File 'lib/mjs/java_script_context.rb', line 475 def to_json( = nil) @variable end |