Sha256: bab7f125b864230c05abe56ed7c2f7e4bcd59b0c9fbf2fa3f306e575bd6e19a0

Contents?: true

Size: 707 Bytes

Versions: 1

Compression:

Stored size: 707 Bytes

Contents

require "flex_station_data/presenters/sample_csv"

module FlexStationData
  module Presenters
    class PlateCsv
      include Concerns::Presenter

      attr_reader :plate, :sample_presenter, :options

      delegate :times, :samples, to: :plate

      def initialize(plate, sample_presenter: SampleCsv, **options)
        @plate = plate
        @sample_presenter = sample_presenter
        @options = options
      end

      def present
        [
          [ "Plate #{plate.label}" ],
          *samples_csv
        ]
      end

      private

      def samples_csv
        samples.flat_map do |sample|
          sample_presenter.present(times, sample, **options)
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
flex-station-data-0.3.2 lib/flex_station_data/presenters/plate_csv.rb