Class: LabelPrinter::Label::SampleManifestPlateDouble

Inherits:
BasePlateDouble show all
Defined in:
lib/label_printer/label/sample_manifest_plate_double.rb

Instance Attribute Summary collapse

Attributes included from MultipleLabels

#count

Instance Method Summary collapse

Methods inherited from BasePlateDouble

#assets, #barcode, #date_today

Methods included from MultipleDoubleLabels

#create_labels, #double_label

Methods included from MultipleLabels

#create_labels, #labels

Constructor Details

#initialize(options) ⇒ SampleManifestPlateDouble

Returns a new instance of SampleManifestPlateDouble.



10
11
12
13
14
# File 'lib/label_printer/label/sample_manifest_plate_double.rb', line 10

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

Instance Attribute Details

#only_first_labelObject (readonly)

Returns the value of attribute only_first_label.



8
9
10
# File 'lib/label_printer/label/sample_manifest_plate_double.rb', line 8

def only_first_label
  @only_first_label
end

#sample_manifestObject (readonly)

Returns the value of attribute sample_manifest.



8
9
10
# File 'lib/label_printer/label/sample_manifest_plate_double.rb', line 8

def sample_manifest
  @sample_manifest
end

Instance Method Details

#build_extra_label(_plate) ⇒ Object



25
26
27
# File 'lib/label_printer/label/sample_manifest_plate_double.rb', line 25

def build_extra_label(_plate)
  { left_text: date_today, right_text: @sample_manifest.purpose.name, label_name: 'extra_label' }
end

#build_label(plate) ⇒ Object



16
17
18
19
20
21
22
23
# File 'lib/label_printer/label/sample_manifest_plate_double.rb', line 16

def build_label(plate)
  {
    left_text: plate.human_barcode,
    right_text: "#{sample_manifest.study.abbreviation} #{plate.barcode_number}",
    barcode: barcode(plate),
    label_name: 'main_label'
  }
end

#platesObject



29
30
31
32
33
# File 'lib/label_printer/label/sample_manifest_plate_double.rb', line 29

def plates
  return [sample_manifest.printables.first] if only_first_label

  sample_manifest.printables
end