class TimeMath::Units::Day

@private

Public Class Methods

new() click to toggle source
Calls superclass method
# File lib/time_math/units/day.rb, line 5
def initialize
  super(:day)
end

Protected Instance Methods

_advance(tm, steps) click to toggle source
Calls superclass method
# File lib/time_math/units/day.rb, line 11
def _advance(tm, steps)
  fix_dst(super(tm, steps), tm)
end
_decrease(tm, steps) click to toggle source
Calls superclass method
# File lib/time_math/units/day.rb, line 15
def _decrease(tm, steps)
  fix_dst(super(tm, steps), tm)
end
fix_dst(res, src) click to toggle source

:nocov: - somehow Travis env thinks other things about DST

# File lib/time_math/units/day.rb, line 20
def fix_dst(res, src)
  return res unless res.is_a?(Time)

  if res.dst? && !src.dst?
    TimeMath.hour.decrease(res)
  elsif !res.dst? && src.dst?
    TimeMath.hour.advance(res)
  else
    res
  end
end