Class: UnboundMethod
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#owner ⇒ Object
readonly
Returns the value of attribute owner.
Instance Method Summary collapse
- #arity ⇒ Object
- #bind(object) ⇒ Object
-
#initialize(owner, method, name) ⇒ UnboundMethod
constructor
A new instance of UnboundMethod.
- #inspect ⇒ Object
- #parameters ⇒ Object
Constructor Details
#initialize(owner, method, name) ⇒ UnboundMethod
Returns a new instance of UnboundMethod
50 51 52 53 54 |
# File 'opal/opal/corelib/method.rb', line 50 def initialize(owner, method, name) @owner = owner @method = method @name = name end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name
48 49 50 |
# File 'opal/opal/corelib/method.rb', line 48 def name @name end |
#owner ⇒ Object (readonly)
Returns the value of attribute owner
48 49 50 |
# File 'opal/opal/corelib/method.rb', line 48 def owner @owner end |
Instance Method Details
#arity ⇒ Object
56 57 58 |
# File 'opal/opal/corelib/method.rb', line 56 def arity @method.arity end |
#bind(object) ⇒ Object
64 65 66 67 68 69 70 |
# File 'opal/opal/corelib/method.rb', line 64 def bind(object) # TODO: re-enable when Module#< is fixed # unless object.class <= @owner # raise TypeError, "can't bind singleton method to a different class" # end Method.new(object, @method, @name) end |
#inspect ⇒ Object
72 73 74 |
# File 'opal/opal/corelib/method.rb', line 72 def inspect "#<UnboundMethod: #{@owner.name}##@name>" end |
#parameters ⇒ Object
60 61 62 |
# File 'opal/opal/corelib/method.rb', line 60 def parameters `#{@method}.$$parameters` end |