Sha256: 480c425e26fa066e163e02991d16b8b185cd7b90e15e422a41314b1d776fb48c
Contents?: true
Size: 979 Bytes
Versions: 3
Compression:
Stored size: 979 Bytes
Contents
require 'chronic' require 'ruby-duration' require 'time_distribution/task_list' module TimeDistribution class WorkDay attr_reader :date, :tasks # @param [#to_s] date Date of this work day in +Chronic+ compatible format. # @param [Array<Task>] tasks List of tasks done in this work day. Defaults to an empty list. def initialize(date, *tasks) @date = Chronic.parse(date) @tasks = TaskList.new(*tasks) end # @param [Task] task Adds +task+ to the list of tasks completed on this work day. def add_task!(task) @tasks << task self end def time_worked(*subjects) @tasks.time_worked *subjects end def to_hours(*subjects) @tasks.to_hours *subjects end def to_md ( @date.strftime('%b %-d, %Y') + "\n============================\n" + @tasks.to_md ) end def to_ssv ( "# #{@date.strftime('%b %-d, %Y')}\n" + @tasks.to_ssv ) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
time_distribution-2.0.2 | lib/time_distribution/work_day.rb |
time_distribution-2.0.1 | lib/time_distribution/work_day.rb |
time_distribution-2.0.0 | lib/time_distribution/work_day.rb |