Class: Robot::Generator::Hamilton

Inherits:
Base
  • Object
show all
Defined in:
app/models/robot/generator/hamilton.rb

Overview

Handles picking file generation for Hamilton robots

Direct Known Subclasses

Beckman

Constant Summary collapse

COLUMN_HEADERS =
%w[SourcePlateID SourceWellID SourcePlateType SourcePlateVolume DestinationPlateID
DestinationWellID DestinationPlateType DestinationPlateVolume WaterVolume].freeze

Instance Attribute Summary

Attributes inherited from Base

#batch, #ctrl_barcode_index, #dest_barcode_index, #picking_data, #plate_barcode, #source_barcode_index

Instance Method Summary collapse

Methods inherited from Base

#initialize, #total_volume

Constructor Details

This class inherits a constructor from Robot::Generator::Base

Instance Method Details

#as_textObject


16
17
18
# File 'app/models/robot/generator/hamilton.rb', line 16

def as_text
  mapping(picking_data)
end

#filename(base) ⇒ Object


7
8
9
# File 'app/models/robot/generator/hamilton.rb', line 7

def filename(base)
  "#{base}.csv"
end

#mapping(data_object = picking_data) ⇒ Object

Formats values in the data object into output rows for the file

Raises:

  • (ArgumentError)

24
25
26
27
28
29
30
# File 'app/models/robot/generator/hamilton.rb', line 24

def mapping(data_object = picking_data)
  raise ArgumentError, 'Data object not present for Hamilton mapping' if data_object.nil?

  output_file_contents = [column_headers]
  output_file_contents << source_mappings(data_object)
  output_file_contents.join("\n").gsub(/\n\n/, "\n")
end

#typeObject

The MIME type of the generated file.


12
13
14
# File 'app/models/robot/generator/hamilton.rb', line 12

def type
  'text/csv'
end