class Timer

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

Attributes

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

Public Class Methods

new(id,name,time) click to toggle source

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.

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

Public Instance Methods

fire?() click to toggle source
# File lib/engine/timer.rb, line 29
def fire?
  @counter -= 1
  @counter < 1
end
reset() click to toggle source
# File lib/engine/timer.rb, line 34
def reset
  @counter = @time
end