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



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

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

Instance Attribute Details

#atObject

Returns the value of attribute at.



5
6
7
# File 'lib/god/driver.rb', line 5

def at
  @at
end

Instance Method Details

#<=>(other) ⇒ Object



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

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

#due?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/god/driver.rb', line 15

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