Class: LabelPrinter::Label::BatchTube
- Defined in:
- lib/label_printer/label_printer/label/batch_tube.rb
Overview
rubocop:todo Style/Documentation
Instance Attribute Summary collapse
-
#batch ⇒ Object
readonly
Returns the value of attribute batch.
-
#count ⇒ Object
readonly
Returns the value of attribute count.
-
#printable ⇒ Object
readonly
Returns the value of attribute printable.
-
#stock ⇒ Object
readonly
Returns the value of attribute stock.
Instance Method Summary collapse
-
#initialize(options) ⇒ BatchTube
constructor
A new instance of BatchTube.
- #middle_line(tube) ⇒ Object
- #round_label_bottom_line(tube) ⇒ Object
- #round_label_top_line(tube) ⇒ Object
- #top_line(tube) ⇒ Object
- #tubes ⇒ Object
Methods inherited from BaseTube
#assets, #barcode, #bottom_line, #create_label, #date_today
Methods included from MultipleLabels
#create_labels, #label, #labels, #to_h
Constructor Details
#initialize(options) ⇒ BatchTube
Returns a new instance of BatchTube.
6 7 8 9 10 11 |
# File 'lib/label_printer/label_printer/label/batch_tube.rb', line 6 def initialize() @count = [:count].to_i @printable = [:printable] @batch = [:batch] @stock = [:stock] end |
Instance Attribute Details
#batch ⇒ Object (readonly)
Returns the value of attribute batch
4 5 6 |
# File 'lib/label_printer/label_printer/label/batch_tube.rb', line 4 def batch @batch end |
#count ⇒ Object (readonly)
Returns the value of attribute count
4 5 6 |
# File 'lib/label_printer/label_printer/label/batch_tube.rb', line 4 def count @count end |
#printable ⇒ Object (readonly)
Returns the value of attribute printable
4 5 6 |
# File 'lib/label_printer/label_printer/label/batch_tube.rb', line 4 def printable @printable end |
#stock ⇒ Object (readonly)
Returns the value of attribute stock
4 5 6 |
# File 'lib/label_printer/label_printer/label/batch_tube.rb', line 4 def stock @stock end |
Instance Method Details
#middle_line(tube) ⇒ Object
26 27 28 |
# File 'lib/label_printer/label_printer/label/batch_tube.rb', line 26 def middle_line(tube) tube.is_a?(PacBioLibraryTube) ? source_well_position(tube) : super end |
#round_label_bottom_line(tube) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/label_printer/label_printer/label/batch_tube.rb', line 34 def round_label_bottom_line(tube) if tube.is_a?(PacBioLibraryTube) source_plate = (tube) # Return the last 4 characters. The fallback handles scenarios where # we have fewer than 4 characters in the string, as: # 'abc'[-4..] # => nil source_plate[-4..] || source_plate else super end end |
#round_label_top_line(tube) ⇒ Object
30 31 32 |
# File 'lib/label_printer/label_printer/label/batch_tube.rb', line 30 def round_label_top_line(tube) tube.is_a?(PacBioLibraryTube) ? source_well_position(tube) : super end |
#top_line(tube) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/label_printer/label_printer/label/batch_tube.rb', line 13 def top_line(tube) if stock.present? tube.name elsif batch.multiplexed? tag_range = tube.receptacle.tag_range tag_range.nil? ? tube.name : "(#{tag_range}) #{tube.id}" elsif tube.is_a? PacBioLibraryTube (tube) else tube.name_for_label end end |
#tubes ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/label_printer/label_printer/label/batch_tube.rb', line 46 def tubes @tubes ||= if stock.present? if batch.multiplexed? # all info on a label including barcode is about target_asset first child requests.map { |request| request.target_labware.children.first } else # all info on a label including barcode is about target_asset stock asset requests.map { |request| request.target_labware.stock_asset } end else # all info on a label including barcode is about target_asset requests.map(&:target_labware) end end |