lib/v8/function.rb in therubyracer-0.7.0 vs lib/v8/function.rb in therubyracer-0.7.1.pre

- old
+ new

@@ -1,19 +1,29 @@ module V8 class Function < V8::Object - def call(thisObject, *args) + def methodcall(thisObject, *args) err = nil return_value = nil C::TryCatch.try do |try| @context.enter do this = To.v8(thisObject) - return_value = To.ruby(@native.Call(this, *args.map {|a| To.v8(a)})) + return_value = To.ruby(@native.Call(this, To.v8(args))) err = JavascriptError.new(try) if try.HasCaught() end end raise err if err return return_value + end + + def call(*args) + self.methodcall(@context.Global(), *args) + end + + def new(*args) + @context.enter do + To.rb(@native.NewInstance(To.v8(args))) + end end def self.rubycall(rubycode, *args) begin To.v8(rubycode.call(*args)) \ No newline at end of file