Class: LabelPrinter::Label::SampleManifestTube
- Defined in:
- lib/label_printer/label/sample_manifest_tube.rb
Instance Attribute Summary collapse
-
#only_first_label ⇒ Object
readonly
Returns the value of attribute only_first_label.
-
#sample_manifest ⇒ Object
readonly
Returns the value of attribute sample_manifest.
Attributes included from MultipleLabels
Instance Method Summary collapse
-
#barcode(tube) ⇒ String
Returns the appropriate barcode for the given tube based on the barcode type.
- #first_line(_tube = nil) ⇒ Object
-
#initialize(options) ⇒ SampleManifestTube
constructor
Initialised only for 1dtube and library.
- #tubes ⇒ Object
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
Constructor Details
#initialize(options) ⇒ SampleManifestTube
Initialised only for 1dtube and library
8 9 10 11 12 13 |
# File 'lib/label_printer/label/sample_manifest_tube.rb', line 8 def initialize() super() @sample_manifest = [:sample_manifest] @only_first_label = [:only_first_label] @barcode_type = [:barcode_type] end |
Instance Attribute Details
#only_first_label ⇒ Object (readonly)
Returns the value of attribute only_first_label.
5 6 7 |
# File 'lib/label_printer/label/sample_manifest_tube.rb', line 5 def only_first_label @only_first_label end |
#sample_manifest ⇒ Object (readonly)
Returns the value of attribute sample_manifest.
5 6 7 |
# File 'lib/label_printer/label/sample_manifest_tube.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.
21 22 23 24 25 26 27 |
# File 'lib/label_printer/label/sample_manifest_tube.rb', line 21 def (tube) if @barcode_type == Rails.application.config.[:barcode_type_labels]['2d'] return tube. end tube. end |
#first_line(_tube = nil) ⇒ Object
29 30 31 |
# File 'lib/label_printer/label/sample_manifest_tube.rb', line 29 def first_line(_tube = nil) sample_manifest.study.abbreviation end |
#tubes ⇒ Object
33 34 35 36 37 |
# File 'lib/label_printer/label/sample_manifest_tube.rb', line 33 def tubes return [sample_manifest.printables.first] if only_first_label sample_manifest.printables end |