Class: AgeCalculator
- Inherits:
-
Object
- Object
- AgeCalculator
- Defined in:
- lib/age_calculator.rb
Instance Method Summary collapse
-
#compute(birth_date, current_date) ⇒ Hash
Calculates an age based on the given current date.
Instance Method Details
#compute(birth_date, current_date) ⇒ Hash
Calculates an age based on the given current date.
14 15 16 17 18 19 20 21 |
# File 'lib/age_calculator.rb', line 14 def compute(birth_date, current_date) calculation = build_calculation(birth_date, current_date) compute_days(calculation, birth_date, current_date) compute_months(calculation, birth_date, current_date) handle_future_dates(calculation) build_hash(calculation) end |