class JavaScript::Prototype

Public Class Methods

new(klass) click to toggle source
Calls superclass method JavaScript::Object::new
# File lib/javascript.rb, line 310
def initialize(klass)
  super(nil)
  @klass = klass
end

Private Instance Methods

method_missing(name, *args, &block) click to toggle source
Calls superclass method JavaScript::Object#method_missing
# File lib/javascript.rb, line 316
def method_missing(name, *args, &block)
  meth = @klass.instance_method(name)
  args = meth.parameters.map { |_, name| name && Identifier.new(name) }.compact
  body = ->(*args) { meth.bind(this).call(*args) }
  Function.new(name, args, body)
rescue NameError
  super
end