Class: EventMachine::Beanstalk::Defer
- Inherits:
-
EM::DefaultDeferrable
- Object
- EM::DefaultDeferrable
- EventMachine::Beanstalk::Defer
- Defined in:
- lib/em-beanstalk/defer.rb
Instance Method Summary collapse
-
#initialize(default_error_callback, &block) ⇒ Defer
constructor
A new instance of Defer.
- #on_error(&block) ⇒ Object
- #on_success(&block) ⇒ Object
Constructor Details
#initialize(default_error_callback, &block) ⇒ Defer
Returns a new instance of Defer.
4 5 6 7 8 |
# File 'lib/em-beanstalk/defer.rb', line 4 def initialize(default_error_callback, &block) @error = default_error_callback callback(&block) if block errback{|| @error.call()} end |
Instance Method Details
#on_error(&block) ⇒ Object
10 11 12 13 |
# File 'lib/em-beanstalk/defer.rb', line 10 def on_error(&block) @error = block self end |
#on_success(&block) ⇒ Object
15 16 17 18 |
# File 'lib/em-beanstalk/defer.rb', line 15 def on_success(&block) callback(&block) self end |