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.



386
387
388
389
# File 'lib/mjs/java_script_context.rb', line 386

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)



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

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