Class: Gouda::CombinedShutdownCheck
- Inherits:
-
Object
- Object
- Gouda::CombinedShutdownCheck
- Defined in:
- lib/gouda/worker.rb
Overview
A wrapping callable which returns ‘true` if any of the given callables return true. This can be used to combine a timed shutdown (“in 30 seconds”) with a signal handler shutdown (“shutdown on SIGTERM/SIGINT”)
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(*callables_for_condition) ⇒ CombinedShutdownCheck
constructor
A new instance of CombinedShutdownCheck.
Constructor Details
#initialize(*callables_for_condition) ⇒ CombinedShutdownCheck
Returns a new instance of CombinedShutdownCheck.
102 103 104 |
# File 'lib/gouda/worker.rb', line 102 def initialize(*callables_for_condition) @conditions = callables_for_condition end |
Instance Method Details
#call ⇒ Object
106 107 108 109 |
# File 'lib/gouda/worker.rb', line 106 def call # Once one shutdown check told us to shut down there is no point to query all the others @memo ||= @conditions.any?(&:call) end |