Class: FlexStationData::ParseSampleMap
- Inherits:
-
Object
- Object
- FlexStationData::ParseSampleMap
- Includes:
- Callable
- Defined in:
- lib/flex_station_data/services/parse_sample_map.rb
Instance Attribute Summary collapse
-
#plate_data ⇒ Object
readonly
Returns the value of attribute plate_data.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(plate_data) ⇒ ParseSampleMap
constructor
A new instance of ParseSampleMap.
- #sample_map_rows ⇒ Object
Constructor Details
#initialize(plate_data) ⇒ ParseSampleMap
Returns a new instance of ParseSampleMap.
14 15 16 |
# File 'lib/flex_station_data/services/parse_sample_map.rb', line 14 def initialize(plate_data) @plate_data = plate_data end |
Instance Attribute Details
#plate_data ⇒ Object (readonly)
Returns the value of attribute plate_data.
12 13 14 |
# File 'lib/flex_station_data/services/parse_sample_map.rb', line 12 def plate_data @plate_data end |
Instance Method Details
#call ⇒ Object
26 27 28 29 30 31 |
# File 'lib/flex_station_data/services/parse_sample_map.rb', line 26 def call sample_map_rows.each_with_object([]) do |(label, well), memo| memo << [ label, [] ] if label.present? memo.last.last << well end.to_h end |
#sample_map_rows ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/flex_station_data/services/parse_sample_map.rb', line 18 def sample_map_rows plate_data .drop_while { |row| !sample_map_header?(row) } .drop(1) .take_while { |row| !empty_row?(row) } .map(&method(:parse_row)) end |