Class: LabelPrinter::Label::BatchTube

Inherits:
BaseTube
  • Object
show all
Defined in:
lib/label_printer/label/batch_tube.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#create_labels, #labels

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(options)
  super()
  @count = options[:count].to_i
  @printable = options[:printable]
  @batch = options[:batch]
  @stock = options[:stock]
end

Instance Attribute Details

#batchObject (readonly)

Returns the value of attribute batch.



5
6
7
# File 'lib/label_printer/label/batch_tube.rb', line 5

def batch
  @batch
end

#countObject (readonly)

Returns the value of attribute count.



5
6
7
# File 'lib/label_printer/label/batch_tube.rb', line 5

def count
  @count
end

#printableObject (readonly)

Returns the value of attribute printable.



5
6
7
# File 'lib/label_printer/label/batch_tube.rb', line 5

def printable
  @printable
end

#stockObject (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
# File 'lib/label_printer/label/batch_tube.rb', line 15

def first_line(tube)
  stock.present? ? tube.name : tube.name_for_label
end

#tubesObject



19
20
21
22
23
24
25
26
27
28
# File 'lib/label_printer/label/batch_tube.rb', line 19

def tubes
  @tubes ||=
    if stock.present?
      # all info on a label including barcode is about target_asset stock asset
      requests.map { |request| request.target_labware.stock_asset }
    else
      # all info on a label including barcode is about target_asset
      requests.map(&:target_labware)
    end
end