Class: Amberletters::ExitTrigger
Instance Attribute Summary collapse
-
#pattern ⇒ Object
readonly
Returns the value of attribute pattern.
Attributes inherited from Trigger
#exclusive, #interruption, #logger, #options, #time_to_live
Instance Method Summary collapse
- #call(process) ⇒ Object
-
#initialize(pattern = 0, options = {}, &block) ⇒ ExitTrigger
constructor
A new instance of ExitTrigger.
- #to_s ⇒ Object
Constructor Details
#initialize(pattern = 0, options = {}, &block) ⇒ ExitTrigger
Returns a new instance of ExitTrigger.
184 185 186 187 |
# File 'lib/amberletters.rb', line 184 def initialize(pattern=0, ={}, &block) super(, &block) @pattern = pattern end |
Instance Attribute Details
#pattern ⇒ Object (readonly)
Returns the value of attribute pattern.
182 183 184 |
# File 'lib/amberletters.rb', line 182 def pattern @pattern end |
Instance Method Details
#call(process) ⇒ Object
189 190 191 192 193 194 195 196 |
# File 'lib/amberletters.rb', line 189 def call(process) if process.status && pattern === process.status.exitstatus @block.call(self, process, process.status) true else false end end |
#to_s ⇒ Object
198 199 200 |
# File 'lib/amberletters.rb', line 198 def to_s "exit with status #{pattern}" end |