Class: LabelPrinter::Label::SampleManifestPlateDouble

Inherits:
BasePlateDouble show all
Defined in:
lib/label_printer/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, #extra_label

Methods included from MultipleLabels

#create_labels, #label, #labels, #to_h

Constructor Details

#initialize(options) ⇒ SampleManifestPlateDouble

Returns a new instance of SampleManifestPlateDouble


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

def initialize(options)
  @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_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_printer/label/sample_manifest_plate_double.rb', line 8

def sample_manifest
  @sample_manifest
end

Instance Method Details

#create_extra_label(_plate) ⇒ Object


21
22
23
24
# File 'lib/label_printer/label_printer/label/sample_manifest_plate_double.rb', line 21

def create_extra_label(_plate)
  { left_text: date_today,
    right_text: @sample_manifest.purpose.name }
end

#create_label(plate) ⇒ Object


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

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

#platesObject


26
27
28
29
30
# File 'lib/label_printer/label_printer/label/sample_manifest_plate_double.rb', line 26

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

  sample_manifest.printables
end