Class: Tube::AttributeUpdater::Molarity

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

Overview

Updates concentration or molarity

Instance Attribute Summary

Attributes inherited from Base

#qc_result, #tube

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

#molarityObject



74
75
76
# File 'app/models/tube/attribute_updater.rb', line 74

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

#molarity?Boolean

Returns:

  • (Boolean)


70
71
72
# File 'app/models/tube/attribute_updater.rb', line 70

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

#updateObject



78
79
80
# File 'app/models/tube/attribute_updater.rb', line 78

def update
  tube.update!(concentration: molarity) if molarity?
end