Parent

Methods

Included Modules

Files

Class/Module Index [+]

Quicksearch

God::TimedEvent

The TimedEvent class represents an event in the future. This class is used by the drivers to schedule upcoming conditional tests and other scheduled events.

Attributes

at[RW]

The Time at which this event is due.

Public Class Methods

new(delay = 0) click to toggle source

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

delay - The optional Numeric number of seconds from now at which to

trigger (default: 0).
# File lib/god/driver.rb, line 23
def initialize(delay = 0)
  self.at = Time.now + delay
end

Public Instance Methods

<=>(other) click to toggle source

Compare this event to another.

other - The other TimedEvent.

Returns -1 if this event is before the other, 0 if the two events are

due at the same time, 1 if the other event is later.
# File lib/god/driver.rb, line 40
def <=>(other)
  self.at <=> other.at
end
due?() click to toggle source

Is the current event due (current time >= event time)?

Returns true if the event is due, false if not.

# File lib/god/driver.rb, line 30
def due?
  Time.now >= self.at
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.