class Time

Public Instance Methods

+(x) click to toggle source
# File lib/abstractive/timespans.rb, line 126
def +(x)
   case x
     when Days;      return Abstractive::TimeSpans.plus_span(self, x.to_seconds).to_time
     when Hours;     return DateTime.new(year, month, day, hour+x.to_i, min, sec, strftime("%:z")).to_time
     when Minutes;   return DateTime.new(year, month, day, hour, min+x.to_i, sec, strftime("%:z")).to_time
     when Seconds;   return DateTime.new(year, month, day, hour, min, sec+x.to_i, strftime("%:z")).to_time
     else;           return self.old_add(x)
   end
end
Also aliased as: old_add
-(x) click to toggle source
# File lib/abstractive/timespans.rb, line 117
def -(x)
   case x
     when Days;      return Abstractive::TimeSpans.minus_span(self, x.to_seconds).to_time
     when Hours;     return DateTime.new(year, month, day, hour-x.to_i, min, sec, strftime("%:z")).to_time
     when Minutes;   return DateTime.new(year, month, day, hour, min-x.to_i, sec, strftime("%:z")).to_time
     when Seconds;   return DateTime.new(year, month, day, hour, min, sec-x.to_i, strftime("%:z")).to_time
     else;           return self.old_subtract(x)
   end
end
Also aliased as: old_subtract
old_add(x)
Alias for: +
old_subtract(x)
Alias for: -