From d1cf3cea0fc1d57565be51b0bc5a1d2658366938 Mon Sep 17 00:00:00 2001 From: Charles Lowell Date: Tue, 3 Aug 2010 08:09:23 -0500 Subject: [PATCH] send messages directly to objects when possible rather than extracting a bound method first. --- lib/v8/function.rb | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/v8/function.rb b/lib/v8/function.rb index 3504efe..1e62fb3 100644 --- a/lib/v8/function.rb +++ b/lib/v8/function.rb @@ -25,9 +25,9 @@ module V8 end end - def self.rubycall(rubycode, *args) + def self.rubyprotect begin - To.v8(rubycode.call(*args)) + To.v8(yield) rescue Exception => e case e when SystemExit, NoMemoryError @@ -40,8 +40,16 @@ module V8 end end + def self.rubycall(rubycode, *args) + rubyprotect do + rubycode.call(*args) + end + end + def self.rubysend(obj, message, *args) - rubycall(obj.method(message), *args) + rubyprotect do + obj.send(message, *args) + end end end end \ No newline at end of file