Class: Event::Every

Inherits:
Event
  • Object
show all
Defined in:
lib/event/every.rb

Constant Summary

Constants inherited from Event

HOUR_DIVISORS, MINUTE_DIVISORS, SECOND_DIVISORS

Instance Attribute Summary collapse

Attributes inherited from Event

#count, #next, #previous, #scheduler, #start, #stop, #times

Instance Method Summary collapse

Methods inherited from Event

#<=>, #alter, at, #call, #due?, every, #extract_time_range, #finished, #finished?, #join, #off, #off?, #on, #on?, #one_done, #reschedule, #seconds_left, timed, #times_left, #to_f, #to_i, #update_scheduler

Instance Attribute Details

#intervalObject (readonly)

Returns the value of attribute interval.



19
20
21
# File 'lib/event/every.rb', line 19

def interval
  @interval
end

Instance Method Details

#inspectObject

A string representation. Just nice for printing.



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/event/every.rb', line 22

def inspect
	string = if off? then
		"Off"
	elsif finished? then
		"Finished"
	elsif left = seconds_left then
		"Due: %s (%.2fs)" %  [@next.strftime("%H:%M:%S"), left]
	else
		"Error"
	end

	"#<%s %s, %s done, scheduled every %.1fs>" %  [
		self.class,
		string,
		@times ? "#{@count}/#{@times}" : @count,
		@interval
	]
end