Class: Well::AttributeUpdater::Base

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

Overview

Base class for AttributeUpdaters, does not perform any action itself but impliments the interface, allowing it to act as a Null Handler in the event we don't recognize the QC type

Direct Known Subclasses

Concentration, GenderMarkers, Rin, SnpCount, Volume

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(well, qc_result) ⇒ Base

Create an attribute updater

Parameters:

  • well (Well)

    The well to update

  • qc_result (QcResult)

    The QCResult to extract the information from


33
34
35
36
# File 'app/models/well/attribute_updater.rb', line 33

def initialize(well, qc_result)
  @well = well
  @qc_result = qc_result
end

Instance Attribute Details

#qc_resultObject (readonly)

Returns the value of attribute qc_result


24
25
26
# File 'app/models/well/attribute_updater.rb', line 24

def qc_result
  @qc_result
end

#wellObject (readonly)

Returns the value of attribute well


24
25
26
# File 'app/models/well/attribute_updater.rb', line 24

def well
  @well
end

Instance Method Details

#original_valueUnit

The original value, complete with units

Returns:

  • (Unit)

    A combination of the the value and its units.


42
43
44
# File 'app/models/well/attribute_updater.rb', line 42

def original_value
  @original_value ||= Unit.new(value, units)
end

#resourceObject

Identifier of the assay for logging


57
58
59
# File 'app/models/well/attribute_updater.rb', line 57

def resource
  "#{assay_type} #{assay_version}"
end

#target_valueObject

The value which will get recorded in the database


47
48
49
# File 'app/models/well/attribute_updater.rb', line 47

def target_value
  original_value.convert_to(target_units).scalar
end

#updateObject

Used in subclasses to perform the relevant update actions on Wells


52
53
54
# File 'app/models/well/attribute_updater.rb', line 52

def update
  # The Base class performs no actions
end