Module: DeferrableGratification::Bothback

Defined in:
lib/deferrable_gratification/bothback.rb

Overview

Allows registering a ‘bothback’ that will be fired on either success or failure, analogous to the ensure clause of a begin/rescue block.

Include this into a class that has already included Deferrable.

Instance Method Summary collapse

Instance Method Details

#bothback(&block) ⇒ Deferrable, Bothback

Register block to be called on either success or failure. This is just a shorthand for registering the same block as both a callback and an errback.

Returns:



12
13
14
15
16
# File 'lib/deferrable_gratification/bothback.rb', line 12

def bothback(&block)
  callback(&block)
  errback(&block)
  self
end