Class: Shove::Client::Callback
- Inherits:
-
Object
- Object
- Shove::Client::Callback
- Defined in:
- lib/shove/client/callback.rb
Overview
Represents a callback that can be canceled
Instance Method Summary collapse
- #call(*args) ⇒ Object
- #cancel ⇒ Object
-
#initialize(group, block) ⇒ Callback
constructor
A new instance of Callback.
Constructor Details
#initialize(group, block) ⇒ Callback
Returns a new instance of Callback.
7 8 9 10 |
# File 'lib/shove/client/callback.rb', line 7 def initialize group, block @group = group @block = block end |
Instance Method Details
#call(*args) ⇒ Object
12 13 14 |
# File 'lib/shove/client/callback.rb', line 12 def call *args @block.call(*args) end |
#cancel ⇒ Object
16 17 18 19 |
# File 'lib/shove/client/callback.rb', line 16 def cancel @group.delete self @block = nil end |