class Nite::Owl::PredicateAction
Public Class Methods
new()
click to toggle source
Calls superclass method
Nite::Owl::Action::new
# File lib/nite/owl/niteowl.rb, line 324 def initialize super() @time = nil @expires = nil end
Public Instance Methods
call(name,flags)
click to toggle source
Calls superclass method
Nite::Owl::Action#call
# File lib/nite/owl/niteowl.rb, line 339 def call(name,flags) $current_action = self begin unless @time @time = Time.now.to_f end if expired? cancel elsif predicate?(name,flags) super(name,flags) cancel else defer(name,flags) end rescue Cancel => c undefer() @time = nil rescue Delay => d handle_delay(d) defer(name,flags) rescue Exception => e STDERR.puts e.message STDERR.puts e.backtrace end end
expired?()
click to toggle source
# File lib/nite/owl/niteowl.rb, line 332 def expired? @expires and @time and (@time+@expires) >= Time.now.to_f end
expires(delay)
click to toggle source
# File lib/nite/owl/niteowl.rb, line 335 def expires(delay) @expires = delay.to_f self end
predicate?(name,flags)
click to toggle source
# File lib/nite/owl/niteowl.rb, line 329 def predicate?(name,flags) true end