lib/timespan/compare.rb in timespan-0.2.0 vs lib/timespan/compare.rb in timespan-0.2.1

- old
+ new

@@ -17,11 +17,10 @@ self.new duration, :reverse => true end end module Compare - include Comparable def time_left time = nil time_compare = time || Time.now diff = end_time - time_compare @@ -45,9 +44,18 @@ seconds <=> time when ActiveSupport::Duration seconds <=> time.to_i end end + + def +(other) + self.duration += Duration.new(other) + end + + def -(other) + self.duration -= Duration.new(other) + end + def valid_compare? time valid_compare_types.any? {|type| time.kind_of? type } end \ No newline at end of file