Class: Mjs::JavaScriptProxy

Inherits:
Object
  • Object
show all
Defined in:
lib/mjs/java_script_context.rb

Overview

TODO

BlackSlate is not supported yet

Instance Method Summary collapse

Constructor Details

#initialize(generator, root = nil) ⇒ JavaScriptProxy

Returns a new instance of JavaScriptProxy.



394
395
396
397
# File 'lib/mjs/java_script_context.rb', line 394

def initialize(generator, root = nil)
  @generator = generator
  @generator << root if root
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *arguments, &block) ⇒ Object (private)



400
401
402
403
404
405
406
# File 'lib/mjs/java_script_context.rb', line 400

def method_missing(method, *arguments, &block)
  if method.to_s =~ /(.*)=$/
    assign($1, arguments.first)
  else
    call("#{Mjs::Utils.camelize(method, :lower)}", *arguments, &block)
  end
end