Class: Remian::Clock

Inherits:
Object
  • Object
show all
Defined in:
lib/remian/clock.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(speed) ⇒ Clock

Returns a new instance of Clock.



5
6
7
8
# File 'lib/remian/clock.rb', line 5

def initialize speed
  @speed = speed.to_f
  @delay = 1.0 / @speed
end

Instance Attribute Details

#delayObject

Returns the value of attribute delay.



3
4
5
# File 'lib/remian/clock.rb', line 3

def delay
  @delay
end

#speedObject

Returns the value of attribute speed.



3
4
5
# File 'lib/remian/clock.rb', line 3

def speed
  @speed
end

Instance Method Details

#tick_delayObject



10
11
12
# File 'lib/remian/clock.rb', line 10

def tick_delay
  sleep @delay
end