Class: Well::AttributeUpdater::Concentration

Inherits:
Base
  • Object
show all
Defined in:
app/models/well/attribute_updater.rb

Overview

Updates concentration or molarity

Instance Attribute Summary

Attributes inherited from Base

#qc_result, #well

Instance Method Summary collapse

Methods inherited from Base

#initialize, #original_value, #resource, #target_value

Constructor Details

This class inherits a constructor from Well::AttributeUpdater::Base

Instance Method Details

#concentrationObject


115
116
117
# File 'app/models/well/attribute_updater.rb', line 115

def concentration
  original_value.convert_to('ng/ul').scalar
end

#concentration?Boolean

Returns:

  • (Boolean)

107
108
109
# File 'app/models/well/attribute_updater.rb', line 107

def concentration?
  original_value.compatible?('ng/ul')
end

#molarityObject


119
120
121
# File 'app/models/well/attribute_updater.rb', line 119

def molarity
  original_value.convert_to('nmol/l').scalar
end

#molarity?Boolean

Returns:

  • (Boolean)

111
112
113
# File 'app/models/well/attribute_updater.rb', line 111

def molarity?
  original_value.compatible?('nmol/l')
end

#updateObject


123
124
125
126
# File 'app/models/well/attribute_updater.rb', line 123

def update
  well.set_concentration(concentration) if concentration?
  well.set_molarity(molarity) if molarity?
end