Module: Tube::AttributeUpdater

Defined in:
app/models/tube/attribute_updater.rb

Overview

Tube::AttributeUpdater provides a collection of small objects to convert a range of qc_results to legacy concentration and volume

Defined Under Namespace

Classes: Base, Molarity, Volume

Constant Summary collapse

HANDLER =

Hash mapping potential QCResult#key to handlers

{
  'volume' => Volume,
  'concentration' => Molarity,
  'molarity' => Molarity
}.freeze

Class Method Summary collapse

Class Method Details

.update(tube, qc_result) ⇒ void

This method returns an undefined value.

Updates the volume and concentration attributes of the provided tube according to the information in the qc result. It automatically:

  • Identifies the attribute to update

  • Scales based on the units provided

  • Generates any required events

Parameters:

  • tube (Tube)

    The tube to update

  • qc_result (QcResult)

    The QCResult to extract the information from


16
17
18
# File 'app/models/tube/attribute_updater.rb', line 16

def self.update(tube, qc_result)
  HANDLER.fetch(qc_result.key.downcase, Base).new(tube, qc_result).update
end