Class: LabelPrinter::Label::SampleManifestMultiplex

Inherits:
BaseTube
  • Object
show all
Defined in:
lib/label_printer/label/sample_manifest_multiplex.rb

Instance Attribute Summary collapse

Attributes included from MultipleLabels

#count

Instance Method Summary collapse

Methods inherited from BaseTube

#assets, #build_label, #date_today, #round_label_bottom_line, #round_label_top_line, #second_line, #third_line

Methods included from MultipleLabels

#create_labels, #labels

Constructor Details

#initialize(options) ⇒ SampleManifestMultiplex

Returns a new instance of SampleManifestMultiplex.



7
8
9
10
11
12
# File 'lib/label_printer/label/sample_manifest_multiplex.rb', line 7

def initialize(options)
  super()
  @sample_manifest = options[:sample_manifest]
  @only_first_label = options[:only_first_label]
  @barcode_type = options[:barcode_type]
end

Instance Attribute Details

#sample_manifestObject (readonly)

Returns the value of attribute sample_manifest.



5
6
7
# File 'lib/label_printer/label/sample_manifest_multiplex.rb', line 5

def sample_manifest
  @sample_manifest
end

Instance Method Details

#barcode(tube) ⇒ String

Returns the appropriate barcode for the given tube based on the barcode type.

Parameters:

  • tube (Tube)

    The tube object for which the barcode is being retrieved. It is expected to respond to human_barcode and machine_barcode.

Returns:

  • (String)

    The human-readable barcode if the barcode type is '2D Barcode', otherwise the machine-readable barcode.



20
21
22
23
24
25
26
# File 'lib/label_printer/label/sample_manifest_multiplex.rb', line 20

def barcode(tube)
  if @barcode_type == Rails.application.config.tube_manifest_barcode_config[:barcode_type_labels]['2d']
    return tube.human_barcode
  end

  tube.machine_barcode
end

#first_line(_tube = nil) ⇒ Object



28
29
30
# File 'lib/label_printer/label/sample_manifest_multiplex.rb', line 28

def first_line(_tube = nil)
  sample_manifest.study.abbreviation
end

#tubesObject



32
33
34
# File 'lib/label_printer/label/sample_manifest_multiplex.rb', line 32

def tubes
  [sample_manifest.printables]
end