class DateTime

Public Instance Methods

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