Method: TZInfo::TimeOrDateTime#+
- Defined in:
- lib/tzinfo/time_or_datetime.rb
#+(seconds) ⇒ Object
Adds a number of seconds to the TimeOrDateTime. Returns a new TimeOrDateTime, preserving what the original constructed type was. If the original type is a Time and the resulting calculation goes out of range for Times, then an exception will be raised by the Time class.
245 246 247 248 249 250 251 252 253 254 255 256 |
# File 'lib/tzinfo/time_or_datetime.rb', line 245 def +(seconds) if seconds == 0 self else if @orig.is_a?(DateTime) TimeOrDateTime.new(@orig + OffsetRationals.rational_for_offset(seconds)) else # + defined for Time and Integer TimeOrDateTime.new(@orig + seconds) end end end |