Class: LabwareCreators::CustomPooledTubes::CsvFile::Header
- Inherits:
-
Object
- Object
- LabwareCreators::CustomPooledTubes::CsvFile::Header
- Includes:
- ActiveModel::Validations
- Defined in:
- app/models/labware_creators/custom_pooled_tubes/csv_file/header.rb
Overview
Class HeaderRow provides a simple wrapper for handling and validating individual CSV rows
Constant Summary collapse
- SOURCE_COLUMN =
'Source Well'
- DEST_COLUMN =
'Dest. well'
- VOL_COLUMN =
'Volume to add to pool'
Instance Attribute Summary collapse
-
#destination_column ⇒ Object
readonly
Return the index of the respective column.
-
#source_column ⇒ Object
readonly
Return the index of the respective column.
-
#volume_column ⇒ Object
readonly
Return the index of the respective column.
Instance Method Summary collapse
-
#initialize(row) ⇒ Header
constructor
Generates a header from the header row array.
-
#to_s ⇒ <String] Outputs the raw header data
Outputs the header as a string.
Constructor Details
#initialize(row) ⇒ Header
Generates a header from the header row array
29 30 31 32 33 34 |
# File 'app/models/labware_creators/custom_pooled_tubes/csv_file/header.rb', line 29 def initialize(row) @row = row || [] @source_column = index_of_header(SOURCE_COLUMN) @destination_column = index_of_header(DEST_COLUMN) @volume_column = index_of_header(VOL_COLUMN) end |
Instance Attribute Details
#destination_column ⇒ Object (readonly)
Return the index of the respective column.
14 15 16 |
# File 'app/models/labware_creators/custom_pooled_tubes/csv_file/header.rb', line 14 def destination_column @destination_column end |
#source_column ⇒ Object (readonly)
Return the index of the respective column.
14 15 16 |
# File 'app/models/labware_creators/custom_pooled_tubes/csv_file/header.rb', line 14 def source_column @source_column end |
#volume_column ⇒ Object (readonly)
Return the index of the respective column.
14 15 16 |
# File 'app/models/labware_creators/custom_pooled_tubes/csv_file/header.rb', line 14 def volume_column @volume_column end |
Instance Method Details
#to_s ⇒ <String] Outputs the raw header data
Outputs the header as a string
41 42 43 |
# File 'app/models/labware_creators/custom_pooled_tubes/csv_file/header.rb', line 41 def to_s @row.join(',') end |