Sha256: 8b0bb67696374e7e12866e45332b7555624bdb7b9e4808c9ceecf40cb08c6e4d

Contents?: true

Size: 662 Bytes

Versions: 2

Compression:

Stored size: 662 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 samples_csv
        samples.flat_map do |sample|
          sample_presenter.present(times, sample, **options)
        end
      end

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

Version data entries

2 entries across 2 versions & 1 rubygems

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