Sha256: f7bdc56659b9fabffc53f312190a72c718050387d17c61eea0292e601383fd08

Contents?: true

Size: 732 Bytes

Versions: 1

Compression:

Stored size: 732 Bytes

Contents

# frozen_string_literal: true

require "active_support/core_ext"

require "flex_station_data/services/parse_plate_readings"
require "flex_station_data/services/parse_sample_map"
require "flex_station_data/plate"

module FlexStationData
  class ParsePlate
    include Concerns::Service

    attr_reader :label, :plate_data

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

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

    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
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
flex-station-data-1.0.2 lib/flex_station_data/services/parse_plate.rb