Class: Respawn::Handler
- Inherits:
-
Object
- Object
- Respawn::Handler
- Defined in:
- lib/respawn/handler.rb
Instance Attribute Summary collapse
-
#block ⇒ Object
readonly
Returns the value of attribute block.
-
#retry_number ⇒ Object
Returns the value of attribute retry_number.
Instance Method Summary collapse
-
#define(&block) ⇒ Object
def predicate(&block) self.predicates << block end.
-
#initialize(onfail) ⇒ Handler
constructor
A new instance of Handler.
Constructor Details
#initialize(onfail) ⇒ Handler
Returns a new instance of Handler.
3 4 5 6 7 |
# File 'lib/respawn/handler.rb', line 3 def initialize(onfail) self.onfail = onfail self.retry_number = 0 # self.predicates = [] end |
Instance Attribute Details
#block ⇒ Object
Returns the value of attribute block.
25 26 27 |
# File 'lib/respawn/handler.rb', line 25 def block @block end |
#retry_number ⇒ Object
Returns the value of attribute retry_number.
23 24 25 |
# File 'lib/respawn/handler.rb', line 23 def retry_number @retry_number end |
Instance Method Details
#define(&block) ⇒ Object
def predicate(&block)
self.predicates << block
end
13 14 15 16 17 18 19 20 21 |
# File 'lib/respawn/handler.rb', line 13 def define(&block) return if self.block if onfail != :handler raise Error, "Cannot define a block unless onfail is :handler" end self.block = block end |