Class: Well::AttributeUpdater::Base
- Inherits:
-
Object
- Object
- Well::AttributeUpdater::Base
- 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
Instance Attribute Summary collapse
-
#qc_result ⇒ Object
readonly
Returns the value of attribute qc_result.
-
#well ⇒ Object
readonly
Returns the value of attribute well.
Instance Method Summary collapse
-
#initialize(well, qc_result) ⇒ Base
constructor
Create an attribute updater.
-
#original_value ⇒ Unit
The original value, complete with units.
-
#resource ⇒ Object
Identifier of the assay for logging.
-
#target_value ⇒ Object
The value which will get recorded in the database.
-
#update ⇒ Object
Used in subclasses to perform the relevant update actions on Wells.
Constructor Details
#initialize(well, qc_result) ⇒ Base
Create an attribute updater
34 35 36 37 |
# File 'app/models/well/attribute_updater.rb', line 34 def initialize(well, qc_result) @well = well @qc_result = qc_result end |
Instance Attribute Details
#qc_result ⇒ Object (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 |
#well ⇒ Object (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_value ⇒ Unit
The original value, complete with units
43 44 45 |
# File 'app/models/well/attribute_updater.rb', line 43 def original_value @original_value ||= Unit.new(value, units) end |
#resource ⇒ Object
Identifier of the assay for logging
58 59 60 |
# File 'app/models/well/attribute_updater.rb', line 58 def resource "#{assay_type} #{assay_version}" end |
#target_value ⇒ Object
The value which will get recorded in the database
48 49 50 |
# File 'app/models/well/attribute_updater.rb', line 48 def target_value original_value.convert_to(target_units).scalar end |
#update ⇒ Object
Used in subclasses to perform the relevant update actions on Wells
53 54 55 |
# File 'app/models/well/attribute_updater.rb', line 53 def update # The Base class performs no actions end |