Class: God::TimedEvent

Inherits:
Object
  • Object
show all
Includes:
Comparable
Defined in:
lib/god/driver.rb

Direct Known Subclasses

DriverEvent, DriverOperation

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(delay = 0) ⇒ TimedEvent

Instantiate a new TimedEvent that will be triggered after the specified delay

+delay+ is the number of seconds from now at which to trigger

Returns TimedEvent



18
19
20
# File 'lib/god/driver.rb', line 18

def initialize(delay = 0)
  self.at = Time.now + delay
end

Instance Attribute Details

#atObject

Returns the value of attribute at.



12
13
14
# File 'lib/god/driver.rb', line 12

def at
  @at
end

Instance Method Details

#<=>(other) ⇒ Object



26
27
28
# File 'lib/god/driver.rb', line 26

def <=>(other)
  self.at <=> other.at
end

#due?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/god/driver.rb', line 22

def due?
  Time.now >= self.at
end