class TimeSpanner::TimeUnits::Decade
Public Class Methods
new()
click to toggle source
Calls superclass method
TimeSpanner::TimeUnits::CalendarUnit::new
# File lib/time_spanner/time_units/decade.rb, line 6 def initialize super 3 end
Private Instance Methods
at_amount(amount)
click to toggle source
# File lib/time_spanner/time_units/decade.rb, line 18 def at_amount amount ( from.to_datetime >> amount * 120 ).to_time end
calculate_amount()
click to toggle source
# File lib/time_spanner/time_units/decade.rb, line 13 def calculate_amount amount = ( to.year - from.year ) / 10 @amount = at_amount( amount ) > to ? amount - 1 : amount end