class TimeSpanner::TimeUnits::Century

Public Class Methods

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

Public Instance Methods

plural_name() click to toggle source

Override!

# File lib/time_spanner/time_units/century.rb, line 11
def plural_name
  :centuries
end

Private Instance Methods

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