Module: MudratProjector::DateDiff
- Extended by:
- DateDiff
- Included in:
- DateDiff
- Defined in:
- lib/mudrat_projector/date_diff.rb
Defined Under Namespace
Classes: Calculator, ComplexCalculator, DayCalculator, MonthCalculator, QuarterCalculator, WeekCalculator, YearCalculator
Instance Method Summary
collapse
Instance Method Details
#advance(intervals: nil, unit: nil, from: nil) ⇒ Object
5
6
7
|
# File 'lib/mudrat_projector/date_diff.rb', line 5
def advance intervals: nil, unit: nil, from: nil
fetch_subclass(unit).advance intervals, from: from
end
|
#date_diff(*maybe_unit_from_to, unit: nil, from: nil, to: nil) ⇒ Object
9
10
11
12
13
14
|
# File 'lib/mudrat_projector/date_diff.rb', line 9
def date_diff *maybe_unit_from_to, unit: nil, from: nil, to: nil
if [unit, from, to].all? &:nil?
unit, from, to = maybe_unit_from_to
end
fetch_subclass(unit).new(from, to).calculate
end
|