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



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

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

#concentration?Boolean

Returns:

  • (Boolean)


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

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

#molarityObject



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

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

#molarity?Boolean

Returns:

  • (Boolean)


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

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

#updateObject



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