Class: LabelPrinter::Label::BaseTube

Inherits:
Object
  • Object
show all
Includes:
MultipleLabels
Defined in:
lib/label_printer/label/base_tube.rb

Instance Attribute Summary

Attributes included from MultipleLabels

#count

Instance Method Summary collapse

Methods included from MultipleLabels

#create_labels, #labels

Instance Method Details

#assetsObject



46
47
48
# File 'lib/label_printer/label/base_tube.rb', line 46

def assets
  tubes
end

#barcode(tube) ⇒ Object



38
39
40
# File 'lib/label_printer/label/base_tube.rb', line 38

def barcode(tube)
  tube.machine_barcode
end

#build_label(tube) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/label_printer/label/base_tube.rb', line 7

def build_label(tube)
  {
    first_line: first_line(tube),
    second_line: second_line(tube),
    third_line: third_line(tube),
    round_label_top_line: round_label_top_line(tube),
    round_label_bottom_line: round_label_bottom_line(tube),
    barcode: barcode(tube),
    label_name: 'main_label'
  }
end

#date_todayObject



50
51
52
# File 'lib/label_printer/label/base_tube.rb', line 50

def date_today
  Time.zone.today.strftime('%e-%^b-%Y')
end

#first_line(tube) ⇒ Object



19
20
# File 'lib/label_printer/label/base_tube.rb', line 19

def first_line(tube)
end

#round_label_bottom_line(tube) ⇒ Object



34
35
36
# File 'lib/label_printer/label/base_tube.rb', line 34

def round_label_bottom_line(tube)
  tube.barcode_number
end

#round_label_top_line(tube) ⇒ Object



30
31
32
# File 'lib/label_printer/label/base_tube.rb', line 30

def round_label_top_line(tube)
  tube.prefix
end

#second_line(tube) ⇒ Object



22
23
24
# File 'lib/label_printer/label/base_tube.rb', line 22

def second_line(tube)
  tube.barcode_number
end

#third_line(_tube) ⇒ Object



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

def third_line(_tube)
  date_today
end

#tubesObject



42
43
44
# File 'lib/label_printer/label/base_tube.rb', line 42

def tubes
  @tubes || []
end