Class: Tube::AttributeUpdater::Molarity
- Defined in:
- app/models/tube/attribute_updater.rb
Overview
Updates concentration or molarity
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
#initialize, #original_value, #target_value
Constructor Details
This class inherits a constructor from Tube::AttributeUpdater::Base
Instance Method Details
#molarity ⇒ Object
74 75 76 |
# File 'app/models/tube/attribute_updater.rb', line 74 def molarity original_value.convert_to('nmol/l').scalar end |
#molarity? ⇒ Boolean
70 71 72 |
# File 'app/models/tube/attribute_updater.rb', line 70 def molarity? original_value.compatible?('nmol/l') end |
#update ⇒ Object
78 79 80 |
# File 'app/models/tube/attribute_updater.rb', line 78 def update tube.update!(concentration: molarity) if molarity? end |