Class: V8::Function
- Includes:
- Error::Try
- Defined in:
- lib/v8/function.rb
Instance Attribute Summary
Attributes inherited from Object
Instance Method Summary collapse
- #call(*args) ⇒ Object
-
#initialize(native = nil) ⇒ Function
constructor
A new instance of Function.
- #methodcall(this, *args) ⇒ Object
- #new(*args) ⇒ Object
Methods included from Error::Try
Methods inherited from Object
#[], #[]=, #each, #keys, #method_missing, #respond_to?, #to_s, #values
Constructor Details
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class V8::Object
Instance Method Details
#call(*args) ⇒ Object
17 18 19 20 21 |
# File 'lib/v8/function.rb', line 17 def call(*args) @context.enter do methodcall @context.native.Global(), *args end end |
#methodcall(this, *args) ⇒ Object
10 11 12 13 14 15 |
# File 'lib/v8/function.rb', line 10 def methodcall(this, *args) @context.enter do this ||= @context.native.Global() @context.to_ruby try {native.Call(@context.to_v8(this), args.map {|a| @context.to_v8 a})} end end |
#new(*args) ⇒ Object
23 24 25 26 27 |
# File 'lib/v8/function.rb', line 23 def new(*args) @context.enter do @context.to_ruby try {native.NewInstance(args.map {|a| @context.to_v8 a})} end end |