class Tempo::Views::ViewRecords::TimeRecordContainer

Handle a collection of time records Pre can hold the title of the collection (date, project, etc.) postreturns the total duration of all contained records

Attributes

duration[RW]

Public Class Methods

new(options={}) click to toggle source
# File lib/tempo/views/view_records/container.rb, line 50
def initialize(options={})
  super options
  @type = "time_record_container"
  @duration = Duration.new
end

Public Instance Methods

add(record) click to toggle source
# File lib/tempo/views/view_records/container.rb, line 56
def add(record)
  # TODO: fail if not a time record
  super record
  @duration.add record.duration.total
end
post() click to toggle source
# File lib/tempo/views/view_records/container.rb, line 62
def post
  ViewRecords::Message.new "Total: ------- [#{duration.format}] --------------------------------\n\n", postpone: true
end