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
517 518 519 |
# File 'lib/hookr.rb', line 517 def handle @handle end |
#index ⇒ Object
Returns the value of attribute index
517 518 519 |
# File 'lib/hookr.rb', line 517 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.
523 524 525 526 527 528 |
# File 'lib/hookr.rb', line 523 def <=>(other) if handle == other.handle return 0 end self.index <=> other.index end |
#call(*args) ⇒ Object
Must be overridden in subclass
531 532 533 |
# File 'lib/hookr.rb', line 531 def call(*args) raise NotImplementedError, "Callback is an abstract class" end |