Class: HookR::Callback
- Inherits:
-
Struct
- Object
- Struct
- HookR::Callback
- Includes:
- Comparable, FailFast::Assertions
- Defined in:
- lib/hookr.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#handle ⇒ Object
Returns the value of attribute handle.
-
#index ⇒ Object
Returns the value of attribute index.
Instance Method Summary collapse
-
#<=>(other) ⇒ Object
Callbacks with the same handle are always equal, which prevents duplicate handles in CallbackSets.
-
#call(*args) ⇒ Object
Must be overridden in subclass.
Instance Attribute Details
#handle ⇒ Object
Returns the value of attribute handle
539 540 541 |
# File 'lib/hookr.rb', line 539 def handle @handle end |
#index ⇒ Object
Returns the value of attribute index
539 540 541 |
# File 'lib/hookr.rb', line 539 def index @index end |
Instance Method Details
#<=>(other) ⇒ Object
Callbacks with the same handle are always equal, which prevents duplicate handles in CallbackSets. Otherwise, callbacks are sorted by index.
545 546 547 548 549 550 |
# File 'lib/hookr.rb', line 545 def <=>(other) if handle == other.handle return 0 end self.index <=> other.index end |
#call(*args) ⇒ Object
Must be overridden in subclass
553 554 555 |
# File 'lib/hookr.rb', line 553 def call(*args) raise NotImplementedError, "Callback is an abstract class" end |