class TimeMath::Units::Year

@private

Public Class Methods

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

Protected Instance Methods

_advance(tm, steps) click to toggle source
# File lib/time_math/units/year.rb, line 19
def _advance(tm, steps)
  Util.merge(tm, year: tm.year + steps.to_i)
end
_decrease(tm, steps) click to toggle source
# File lib/time_math/units/year.rb, line 23
def _decrease(tm, steps)
  Util.merge(tm, year: tm.year - steps.to_i)
end
_measure(from, to) click to toggle source
# File lib/time_math/units/year.rb, line 11
def _measure(from, to)
  if Util.merge(from, year: to.year) <= to
    to.year - from.year
  else
    to.year - from.year - 1
  end
end