Class: LabelPrinter::Label::BaseTube

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

Overview

rubocop:todo Style/Documentation

Instance Attribute Summary

Attributes included from MultipleLabels

#count

Instance Method Summary collapse

Methods included from MultipleLabels

#create_labels, #label, #labels, #to_h

Instance Method Details

#assetsObject


44
45
46
# File 'lib/label_printer/label_printer/label/base_tube.rb', line 44

def assets
  tubes
end

#barcode(tube) ⇒ Object


36
37
38
# File 'lib/label_printer/label_printer/label/base_tube.rb', line 36

def barcode(tube)
  tube.machine_barcode
end

#bottom_line(_tube) ⇒ Object


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

def bottom_line(_tube)
  date_today
end

#create_label(tube) ⇒ Object


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

def create_label(tube)
  {
    top_line: top_line(tube),
    middle_line: middle_line(tube),
    bottom_line: bottom_line(tube),
    round_label_top_line: round_label_top_line(tube),
    round_label_bottom_line: round_label_bottom_line(tube),
    barcode: barcode(tube)
  }
end

#date_todayObject


48
49
50
# File 'lib/label_printer/label_printer/label/base_tube.rb', line 48

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

#middle_line(tube) ⇒ Object


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

def middle_line(tube)
  tube.barcode_number
end

#round_label_bottom_line(tube) ⇒ Object


32
33
34
# File 'lib/label_printer/label_printer/label/base_tube.rb', line 32

def round_label_bottom_line(tube)
  tube.barcode_number
end

#round_label_top_line(tube) ⇒ Object


28
29
30
# File 'lib/label_printer/label_printer/label/base_tube.rb', line 28

def round_label_top_line(tube)
  tube.prefix
end

#top_line(tube) ⇒ Object


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

def top_line(tube); end

#tubesObject


40
41
42
# File 'lib/label_printer/label_printer/label/base_tube.rb', line 40

def tubes
  @tubes || []
end