Module: LabelPrinter::Label::MultipleLabels

Included in:
BasePlate, BaseTube, MultipleDoubleLabels
Defined in:
lib/label_printer/label_printer/label.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#countObject

Returns the value of attribute count


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

def count
  @count
end

Instance Method Details

#create_labelsObject


16
17
18
19
20
21
22
23
# File 'lib/label_printer/label_printer/label.rb', line 16

def create_labels
  [].tap do |l|
    assets.each do |asset|
      label = label(asset)
      count.times { l.push(label) }
    end
  end
end

#label(asset) ⇒ Object


25
26
27
# File 'lib/label_printer/label_printer/label.rb', line 25

def label(asset)
  { main_label: create_label(asset) }
end

#labelsObject


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

def labels
  return [] unless assets

  { body: create_labels }
end

#to_hObject


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

def to_h
  { labels: labels }
end