Class: Renalware::PD::APD::CalculateVolumes

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

Instance Method Summary collapse

Constructor Details

#initialize(regime) ⇒ CalculateVolumes

Returns a new instance of CalculateVolumes.



10
11
12
13
14
# File 'app/models/renalware/pd/apd/calculate_volumes.rb', line 10

def initialize(regime)
  raise ArgumentError("Not an APD regime") unless regime.apd?

  @regime = decorate(regime)
end

Instance Method Details

#callObject

rubocop:disable Metrics/AbcSize



17
18
19
20
21
22
23
# File 'app/models/renalware/pd/apd/calculate_volumes.rb', line 17

def call
  regime.overnight_volume = regime.calculated_overnight_volume
  regime.daily_volume = regime.calculated_daily_volume
  regime.glucose_volume_low_strength = regime.volume_of_glucose_at_strength(:low)
  regime.glucose_volume_medium_strength = regime.volume_of_glucose_at_strength(:medium)
  regime.glucose_volume_high_strength = regime.volume_of_glucose_at_strength(:high)
end