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
Constructor Details
#initialize(owner, method, name) ⇒ UnboundMethod
Returns a new instance of UnboundMethod
46 47 48 49 50 |
# File 'opal/opal/corelib/method.rb', line 46 def initialize(owner, method, name) @owner = owner @method = method @name = name end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name
44 45 46 |
# File 'opal/opal/corelib/method.rb', line 44 def name @name end |
#owner ⇒ Object (readonly)
Returns the value of attribute owner
44 45 46 |
# File 'opal/opal/corelib/method.rb', line 44 def owner @owner end |
Instance Method Details
#arity ⇒ Object
52 53 54 |
# File 'opal/opal/corelib/method.rb', line 52 def arity @method.arity end |
#bind(object) ⇒ Object
56 57 58 59 60 61 62 |
# File 'opal/opal/corelib/method.rb', line 56 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
64 65 66 |
# File 'opal/opal/corelib/method.rb', line 64 def inspect "#<UnboundMethod: #{@owner.name}##@name>" end |