class TimeSpanner::TimeUnits::CalendarUnit
Attributes
from[R]
to[R]
Public Class Methods
new(position)
click to toggle source
Calls superclass method
# File lib/time_spanner/time_units/base/calendar_unit.rb, line 8 def initialize position super position end
Public Instance Methods
calculate(duration, to)
click to toggle source
# File lib/time_spanner/time_units/base/calendar_unit.rb, line 12 def calculate duration, to @to = to @from = @to - duration.to_r calculate_amount calculate_rest at_amount( amount ) end
Private Instance Methods
calculate_rest(from)
click to toggle source
# File lib/time_spanner/time_units/base/calendar_unit.rb, line 23 def calculate_rest from @rest = to.to_r - from.to_r end