Class: Shove::Client::Callback

Inherits:
Object
  • Object
show all
Defined in:
lib/shove/client/callback.rb

Overview

Represents a callback that can be canceled

Instance Method Summary collapse

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

#cancelObject



16
17
18
19
# File 'lib/shove/client/callback.rb', line 16

def cancel
  @group.delete self
  @block = nil
end