Module: Utilrb::Timepoints
- Defined in:
- lib/utilrb/timepoints.rb
Instance Method Summary collapse
Instance Method Details
#add_timepoint(*names) ⇒ Object
8 9 10 11 |
# File 'lib/utilrb/timepoints.rb', line 8 def add_timepoint(*names) @timepoints ||= Array.new @timepoints << [Time.now, names] end |
#clear_timepoints ⇒ Object
3 4 5 6 |
# File 'lib/utilrb/timepoints.rb', line 3 def clear_timepoints @timepoints ||= Array.new @timepoints.clear end |
#format_timepoints ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/utilrb/timepoints.rb', line 13 def format_timepoints result = [] @timepoints.inject(@timepoints.first.first) do |last_t, (t, name)| result << name + [t - last_t] t end result end |