Class: Well::AttributeUpdater::Concentration
- Inherits:
-
Base
- Object
- Base
- Well::AttributeUpdater::Concentration
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
Instance Method Details
#concentration ⇒ Object
116
117
118
|
# File 'app/models/well/attribute_updater.rb', line 116
def concentration
original_value.convert_to('ng/ul').scalar
end
|
#concentration? ⇒ Boolean
108
109
110
|
# File 'app/models/well/attribute_updater.rb', line 108
def concentration?
original_value.compatible?('ng/ul')
end
|
#molarity ⇒ Object
120
121
122
|
# File 'app/models/well/attribute_updater.rb', line 120
def molarity
original_value.convert_to('nmol/l').scalar
end
|
#molarity? ⇒ Boolean
112
113
114
|
# File 'app/models/well/attribute_updater.rb', line 112
def molarity?
original_value.compatible?('nmol/l')
end
|
#update ⇒ Object
124
125
126
127
|
# File 'app/models/well/attribute_updater.rb', line 124
def update
well.set_concentration(concentration) if concentration?
well.set_molarity(molarity) if molarity?
end
|