Class Timer
In: lib/engine/timer.rb
Parent: Object
Timer
dot/f_20.png

The Timer class defines the necessary data to keep track of timers for objects

Methods

fire?   new   reset  

Attributes

id  [RW] 
name  [RW] 
time  [RW] 

Public Class methods

Constructor for a Timer object.

id
The id of the object
name
The symbol that defines the kind of timer event.
time
Optional information needed to process the event.
return
A reference to the Timer.

[Source]

# File lib/engine/timer.rb, line 25
  def initialize(id,name,time)
    @id,@name,@time,@counter=id,name,time,time
  end

Public Instance methods

[Source]

# File lib/engine/timer.rb, line 29
  def fire?
    @counter -= 1
    @counter < 1
  end

[Source]

# File lib/engine/timer.rb, line 34
  def reset
    @counter = @time
  end

[Validate]