Class: LabelPrinter::Label::BatchTube
- Defined in:
- lib/label_printer/label/batch_tube.rb
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
- #first_line(tube) ⇒ Object
-
#initialize(options) ⇒ BatchTube
constructor
A new instance of BatchTube.
- #tubes ⇒ Object
Methods inherited from BaseTube
#assets, #barcode, #build_label, #date_today, #round_label_bottom_line, #round_label_top_line, #second_line, #third_line
Methods included from MultipleLabels
Constructor Details
#initialize(options) ⇒ BatchTube
Returns a new instance of BatchTube.
7 8 9 10 11 12 13 |
# File 'lib/label_printer/label/batch_tube.rb', line 7 def initialize() super() @count = [:count].to_i @printable = [:printable] @batch = [:batch] @stock = [:stock] end |
Instance Attribute Details
#batch ⇒ Object (readonly)
Returns the value of attribute batch.
5 6 7 |
# File 'lib/label_printer/label/batch_tube.rb', line 5 def batch @batch end |
#count ⇒ Object (readonly)
Returns the value of attribute count.
5 6 7 |
# File 'lib/label_printer/label/batch_tube.rb', line 5 def count @count end |
#printable ⇒ Object (readonly)
Returns the value of attribute printable.
5 6 7 |
# File 'lib/label_printer/label/batch_tube.rb', line 5 def printable @printable end |
#stock ⇒ Object (readonly)
Returns the value of attribute stock.
5 6 7 |
# File 'lib/label_printer/label/batch_tube.rb', line 5 def stock @stock end |
Instance Method Details
#first_line(tube) ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/label_printer/label/batch_tube.rb', line 15 def first_line(tube) if stock.present? tube.name else tube.respond_to?(:name_for_label) ? tube.name_for_label : tube.name end end |
#tubes ⇒ Object
23 24 25 26 27 28 29 30 31 |
# File 'lib/label_printer/label/batch_tube.rb', line 23 def tubes # If target_asset is a lane, use its parent tube. # If stock is present, all label info (including barcode) is about the stock asset; # otherwise, all label info is about the target_labware. @tubes ||= begin targets = requests.map { |r| r.target_asset.is_a?(Lane) ? r.target_labware.parent : r.target_labware } stock.present? ? targets.map(&:stock_asset) : targets end end |