Class: IntervalTimer
- Inherits:
-
Object
- Object
- IntervalTimer
- Defined in:
- lib/interval_timer/version.rb,
lib/interval_timer/interval_timer.rb
Constant Summary collapse
- VERSION =
'0.0.3'
Class Method Summary collapse
Instance Method Summary collapse
- #check_in(message = nil) ⇒ Object (also: #mark)
- #check_ins ⇒ Object
- #report(message = nil) ⇒ Object
- #start ⇒ Object
Class Method Details
.started ⇒ Object
2 3 4 5 6 |
# File 'lib/interval_timer/interval_timer.rb', line 2 def self.started timer = new timer.start timer end |
Instance Method Details
#check_in(message = nil) ⇒ Object Also known as: mark
14 15 16 17 18 |
# File 'lib/interval_timer/interval_timer.rb', line 14 def check_in( = nil) check_in = build_check_in() check_ins.push(check_in) check_in end |
#check_ins ⇒ Object
28 29 30 |
# File 'lib/interval_timer/interval_timer.rb', line 28 def check_ins @check_ins ||= [] end |
#report(message = nil) ⇒ Object
21 22 23 24 25 26 |
# File 'lib/interval_timer/interval_timer.rb', line 21 def report( = nil) [ report_header().join("\n"), report_body.join("\n") ].join("\n") end |
#start ⇒ Object
8 9 10 11 12 |
# File 'lib/interval_timer/interval_timer.rb', line 8 def start raise "Already started" if @start_time @start_time = Time.now end |