Class: V8::Function
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Object
#[], #[]=, #each, #initialize, #method_missing, #respond_to?, #to_s
Constructor Details
This class inherits a constructor from V8::Object
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class V8::Object
Class Method Details
.rubycall(rubycode, *args) ⇒ Object
28 29 30 31 32 33 34 35 36 |
# File 'lib/v8/function.rb', line 28 def self.rubycall(rubycode, *args) begin To.v8(rubycode.call(*args)) rescue Exception => e error = V8::C::Exception::Error(V8::C::String::New(e.)) error.SetHiddenValue("TheRubyRacer::Cause", C::External::New(e)) V8::C::ThrowException(error) end end |
Instance Method Details
#call(*args) ⇒ Object
18 19 20 |
# File 'lib/v8/function.rb', line 18 def call(*args) self.methodcall(@context.Global(), *args) end |
#methodcall(thisObject, *args) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/v8/function.rb', line 4 def methodcall(thisObject, *args) err = nil return_value = nil C::TryCatch.try do |try| @context.enter do this = To.v8(thisObject) return_value = To.rb(@native.Call(this, To.v8(args))) err = JSError.new(try) if try.HasCaught() end end raise err if err return return_value end |