Class: Nimo::Timer

Inherits:
Object show all
Defined in:
lib/nimo/screen.rb

Instance Method Summary collapse

Constructor Details

#initialize(start_time, delay_in_seconds, action) ⇒ Timer

Returns a new instance of Timer.



90
91
92
# File 'lib/nimo/screen.rb', line 90

def initialize(start_time, delay_in_seconds, action)
	@start_time, @delay_in_seconds, @action = start_time, delay_in_seconds, action
end

Instance Method Details

#run_actionObject



98
99
100
# File 'lib/nimo/screen.rb', line 98

def run_action
	@action.call
end

#time_is_up?Boolean

Returns:

  • (Boolean)


94
95
96
# File 'lib/nimo/screen.rb', line 94

def time_is_up?
	(Time.now.to_f - @start_time) > @delay_in_seconds
end