Class: CsvFile::RowForTubeRack
- Inherits:
-
RowBase
- Object
- RowBase
- CsvFile::RowForTubeRack
- Defined in:
- app/models/labware_creators/common_file_handling/csv_file/row_for_tube_rack.rb
Overview
This is an shared class for handling rows within tube rack csv files. It provides a simple wrapper for handling and validating an individual row A row in this file should contain a tube location (coordinate within rack) and a tube barcode i.e. Tube Position, Tube Barcode
Direct Known Subclasses
Constant Summary collapse
- TUBE_LOCATION_NOT_RECOGNISED =
'contains an invalid coordinate, in %s'
- TUBE_BARCODE_MISSING =
'cannot be empty, in %s'
Instance Attribute Summary collapse
-
#index ⇒ Object
readonly
Returns the value of attribute index.
-
#tube_barcode ⇒ Object
readonly
Returns the value of attribute tube_barcode.
-
#tube_position ⇒ Object
readonly
Returns the value of attribute tube_position.
Instance Method Summary collapse
Instance Attribute Details
#index ⇒ Object (readonly)
Returns the value of attribute index.
19 20 21 |
# File 'app/models/labware_creators/common_file_handling/csv_file/row_for_tube_rack.rb', line 19 def index @index end |
#tube_barcode ⇒ Object (readonly)
Returns the value of attribute tube_barcode.
19 20 21 |
# File 'app/models/labware_creators/common_file_handling/csv_file/row_for_tube_rack.rb', line 19 def @tube_barcode end |
#tube_position ⇒ Object (readonly)
Returns the value of attribute tube_position.
19 20 21 |
# File 'app/models/labware_creators/common_file_handling/csv_file/row_for_tube_rack.rb', line 19 def tube_position @tube_position end |
Instance Method Details
#expected_number_of_columns ⇒ Object
42 43 44 |
# File 'app/models/labware_creators/common_file_handling/csv_file/row_for_tube_rack.rb', line 42 def expected_number_of_columns 2 end |
#initialize_context_specific_fields ⇒ Object
29 30 31 32 33 34 |
# File 'app/models/labware_creators/common_file_handling/csv_file/row_for_tube_rack.rb', line 29 def initialize_context_specific_fields # NB. cannot use upcase here as unusual characters will cause an exception and this happens before the # check_for_invalid_characters validation @tube_position = (@row_data[0] || '').strip @tube_barcode = (@row_data[1] || '').strip end |
#to_s ⇒ Object
36 37 38 39 40 |
# File 'app/models/labware_creators/common_file_handling/csv_file/row_for_tube_rack.rb', line 36 def to_s # NB. index is zero based and no header row here row_number = @index + 1 @tube_position.present? ? "row #{row_number} [#{@tube_position}]" : "row #{row_number}" end |