lib/time_distribution/task.rb in time_distribution-0.0.1 vs lib/time_distribution/task.rb in time_distribution-1.0.0

- old
+ new

@@ -1,21 +1,16 @@ -require 'chronic_duration' +require 'time_distribution/smart_duration' -require_relative 'smart_duration' +module TimeDistribution + class Task + attr_reader :subject, :time_taken, :desc -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}" + # @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 end end \ No newline at end of file