Sha256: 6aa9cb96d2a60c50ad9e2fbaba53b63ec1bfa019f5085245b8dd30196a713852
Contents?: true
Size: 706 Bytes
Versions: 1
Compression:
Stored size: 706 Bytes
Contents
require 'chronic_duration' require_relative 'smart_duration' class Task attr_reader :subject, :time_taken, :desc # @param [#to_s] subject The subject on which the task was completed. E.g. A course or project. # @param [#to_s] time_taken The amount of time taken on the task (Compatible with +ChronicDuration+ parsing, or a range of times that conform to +Chronic+ parsing). # @param [#to_s] desc The task's description. def initialize(subject, time_taken, desc) @subject = subject @time_taken = SmartDuration.parse(time_taken) @desc = desc end def to_s # @todo Format time properly "#{ChronicDuration.parse(@time_taken.total)} spent on #{@subject}: #{@desc}" end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
time_distribution-0.0.1 | lib/time_distribution/task.rb |