Class: Renalware::PD::CAPDRegime::GlucoseStrength
- Inherits:
-
Object
- Object
- Renalware::PD::CAPDRegime::GlucoseStrength
- Defined in:
- app/models/renalware/pd/capd_regime.rb
Instance Attribute Summary collapse
-
#weekly_totals ⇒ Object
readonly
Returns the value of attribute weekly_totals.
Instance Method Summary collapse
- #daily_average ⇒ Object
-
#initialize ⇒ GlucoseStrength
constructor
A new instance of GlucoseStrength.
Constructor Details
#initialize ⇒ GlucoseStrength
Returns a new instance of GlucoseStrength.
58 59 60 |
# File 'app/models/renalware/pd/capd_regime.rb', line 58 def initialize @weekly_totals = [] end |
Instance Attribute Details
#weekly_totals ⇒ Object (readonly)
Returns the value of attribute weekly_totals.
56 57 58 |
# File 'app/models/renalware/pd/capd_regime.rb', line 56 def weekly_totals @weekly_totals end |
Instance Method Details
#daily_average ⇒ Object
62 63 64 65 |
# File 'app/models/renalware/pd/capd_regime.rb', line 62 def daily_average per_week_total = weekly_totals.inject(0.0){ |sum, volume| sum + volume } per_week_total / 7.to_f end |