Class: FlexStationData::ParsePlate

Inherits:
Object
  • Object
show all
Includes:
Callable
Defined in:
lib/flex_station_data/services/parse_plate.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(label, plate_data) ⇒ ParsePlate

Returns a new instance of ParsePlate.



15
16
17
18
# File 'lib/flex_station_data/services/parse_plate.rb', line 15

def initialize(label, plate_data)
  @label = label
  @plate_data = plate_data
end

Instance Attribute Details

#labelObject (readonly)

Returns the value of attribute label.



13
14
15
# File 'lib/flex_station_data/services/parse_plate.rb', line 13

def label
  @label
end

#plate_dataObject (readonly)

Returns the value of attribute plate_data.



13
14
15
# File 'lib/flex_station_data/services/parse_plate.rb', line 13

def plate_data
  @plate_data
end

Instance Method Details

#callObject



24
25
26
27
28
# File 'lib/flex_station_data/services/parse_plate.rb', line 24

def call
  times, temperatures, wells = ParsePlateReadings.call(data_blocks[0])
  sample_map = ParseSampleMap.call(data_blocks[1])
  Plate.new(label, times, temperatures, wells, sample_map)
end

#data_blocksObject



20
21
22
# File 'lib/flex_station_data/services/parse_plate.rb', line 20

def data_blocks
  plate_data.split { |row| row[0] =~ /\A~End\s*\z/ }
end