Module: LabelPrinter::Label::MultipleLabels

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

Overview

rubocop:todo Style/Documentation

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#countObject

Returns the value of attribute count.


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

def count
  @count
end

Instance Method Details

#create_labelsObject


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

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

#label(asset) ⇒ Object


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

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

#labelsObject


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

def labels
  return [] unless assets

  { body: create_labels }
end

#to_hObject


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

def to_h
  { labels: labels }
end