class Amberletters::TimeoutTrigger
Attributes
expiration_time[R]
Public Class Methods
new(expiration_time=Time.now+1.0, options={}, &block)
click to toggle source
Calls superclass method
Amberletters::Trigger::new
# File lib/amberletters.rb, line 159 def initialize(expiration_time=Time.now+1.0, options={}, &block) super(options, &block) @expiration_time = case expiration_time when Time then expiration_time when Numeric then Time.now + expiration_time end end
Public Instance Methods
call(process)
click to toggle source
# File lib/amberletters.rb, line 171 def call(process) if process.time >= expiration_time @block.call(self, process, process.blocker) true else false end end
to_s()
click to toggle source
# File lib/amberletters.rb, line 167 def to_s "timeout at #{expiration_time}" end