class Class::Proxy

Public Class Methods

new(js, *args) click to toggle source
# File lib/gherkin/native/therubyracer.rb, line 22
def initialize(js, *args)
  cxt = V8::Context.new
  cxt['module'] = {}

  # Mimic Node.js / Firebug console.log
  cxt['console'] = STDOUT
  def STDOUT.log(*a)
    puts sprintf(*a.map(&:to_s))
  end

  cxt.load(js)
  @js_obj = cxt['module']['exports'].new(*args)
end

Public Instance Methods

method_missing(name, *args) click to toggle source
# File lib/gherkin/native/therubyracer.rb, line 36
def method_missing(name, *args)
  a = args.map{|a| a.respond_to?(:to_hash) ? a.to_hash : a}
  @js_obj.__send__(name, *a)
end