Class: LabelPrinter::Label::BatchPlateAmp

Inherits:
Object
  • Object
show all
Includes:
MultipleLabels
Defined in:
lib/label_printer/label/batch_plate_amp.rb

Overview

Label for printing plates specific to the AMP step in the Ultima sequencing pipeline These particular plates don't exist as Labware in the system, we're just creating barcode labels for them, based off the batch id and parent tube barcodes.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from MultipleLabels

#create_labels, #labels

Constructor Details

#initialize(options) ⇒ BatchPlateAmp

Returns a new instance of BatchPlateAmp.



15
16
17
18
19
20
# File 'lib/label_printer/label/batch_plate_amp.rb', line 15

def initialize(options)
  super()
  @count = options[:count].to_i
  @printable = options[:printable]
  @batch = options[:batch]
end

Instance Attribute Details

#countObject (readonly)

Returns the value of attribute count.



13
14
15
# File 'lib/label_printer/label/batch_plate_amp.rb', line 13

def count
  @count
end

Instance Method Details

#assetsObject

Not really assets, just identifiers for off-LIMS plates, but method name kept for compatibility with MultipleLabels module



49
50
51
# File 'lib/label_printer/label/batch_plate_amp.rb', line 49

def assets
  parent_tube_barcodes
end

#build_label(parent_tube_barcode) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
# File 'lib/label_printer/label/batch_plate_amp.rb', line 22

def build_label(parent_tube_barcode)
  {
    top_left: date_today,
    bottom_left: plate_barcode(parent_tube_barcode),
    top_right: nil,
    bottom_right: nil,
    top_far_right: nil,
    barcode: plate_barcode(parent_tube_barcode),
    label_name: 'main_label'
  }
end

#date_todayObject



34
35
36
# File 'lib/label_printer/label/batch_plate_amp.rb', line 34

def date_today
  Time.zone.today.strftime('%e-%^b-%Y')
end

#parent_tube_barcodesObject



42
43
44
45
# File 'lib/label_printer/label/batch_plate_amp.rb', line 42

def parent_tube_barcodes
  # comes from checkboxes selected on the page
  @printable.select { |_barcode, check| check == 'on' }.keys
end

#plate_barcode(tube_barcode) ⇒ Object



38
39
40
# File 'lib/label_printer/label/batch_plate_amp.rb', line 38

def plate_barcode(tube_barcode)
  "#{@batch.id}-#{tube_barcode}"
end