Class: Renalware::PD::APD::GlucoseCalculator

Inherits:
Object
  • Object
show all
Defined in:
app/models/renalware/pd/apd/glucose_calculator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(regime:, strength:) ⇒ GlucoseCalculator

Returns a new instance of GlucoseCalculator.



12
13
14
15
# File 'app/models/renalware/pd/apd/glucose_calculator.rb', line 12

def initialize(regime:, strength:)
  @regime = regime
  @bags = bags_having_glucose_strength(regime.bags, strength)
end

Instance Attribute Details

#bagsObject (readonly)

Returns the value of attribute bags.



9
10
11
# File 'app/models/renalware/pd/apd/glucose_calculator.rb', line 9

def bags
  @bags
end

#regimeObject (readonly)

Returns the value of attribute regime.



9
10
11
# File 'app/models/renalware/pd/apd/glucose_calculator.rb', line 9

def regime
  @regime
end

Instance Method Details

#glucose_contentObject

See calculating_apd_volumes.feature for a description of the algorithm here.



18
19
20
# File 'app/models/renalware/pd/apd/glucose_calculator.rb', line 18

def glucose_content
  overnight_glucose_content + other_glucose_content
end