class TimeSpanner::TimeUnits::Year

Public Class Methods

new() click to toggle source
# File lib/time_spanner/time_units/year.rb, line 6
def initialize
  super 4
end

Private Instance Methods

at_amount(amount) click to toggle source
# File lib/time_spanner/time_units/year.rb, line 18
def at_amount amount
  ( from.to_datetime >> amount * 12 ).to_time
end
calculate_amount() click to toggle source
# File lib/time_spanner/time_units/year.rb, line 13
def calculate_amount
  amount  = to.year - from.year
  @amount = at_amount( amount ) > to ? amount - 1 : amount
end