class TimeSpanner::TimeUnits::Week

Public Class Methods

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

Private Instance Methods

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