Class: Renalware::AutomaticAgeCalculator
- Inherits:
-
Object
- Object
- Renalware::AutomaticAgeCalculator
- Defined in:
- lib/renalware/automatic_age_calculator.rb
Instance Method Summary collapse
- #compute ⇒ Object
-
#initialize(age, born_on:, age_on_date:) ⇒ AutomaticAgeCalculator
constructor
A new instance of AutomaticAgeCalculator.
Constructor Details
#initialize(age, born_on:, age_on_date:) ⇒ AutomaticAgeCalculator
Returns a new instance of AutomaticAgeCalculator.
7 8 9 10 11 |
# File 'lib/renalware/automatic_age_calculator.rb', line 7 def initialize(age, born_on:, age_on_date:) @age = age @born_on = born_on @age_on_date = age_on_date end |
Instance Method Details
#compute ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/renalware/automatic_age_calculator.rb', line 13 def compute if @born_on.present? parts = AgeCalculator.new.compute(@born_on, @age_on_date) Age.new_from(parts) else @age end end |