Class: Sol::JSFunction

Inherits:
JSObject show all
Defined in:
lib/jx/jsfunction.rb

Instance Attribute Summary

Attributes inherited from JSObject

#jsvalue

Instance Method Summary collapse

Methods inherited from JSObject

#array?, #assign, #boolean?, #boolean_object?, build, #initialize, #instanceof, #method_missing, #nil?, #number?, #number_object?, #object?, #string?, #string_object?, #undefined?

Constructor Details

This class inherits a constructor from Sol::JSObject

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Sol::JSObject

Instance Method Details

#[](*args) ⇒ Object





59
60
61
# File 'lib/jx/jsfunction.rb', line 59

def[](*args)
  send(*args)
end

#function?Boolean



Returns:

  • (Boolean)


42
43
44
# File 'lib/jx/jsfunction.rb', line 42

def function?
  true
end

#new(*args) ⇒ Object


Create a new object using this function as a constructor




67
68
69
# File 'lib/jx/jsfunction.rb', line 67

def new(*args)
  B.rr.new_object(@jsvalue, *args)
end

#send(*args) ⇒ Object





50
51
52
53
# File 'lib/jx/jsfunction.rb', line 50

def send(*args)
  # args need to be processed before invokation converting then to JSObjects
  B.invoke(@scope, @jsvalue, *(B.process_args2(args)))
end

#typeofObject





34
35
36
# File 'lib/jx/jsfunction.rb', line 34

def typeof
  B.push("function")
end