Class: LabelPrinter::Label::AssetRedirect

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ AssetRedirect

Returns a new instance of AssetRedirect.



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

def initialize(options)
  @printables = options[:printables]
  @printer_type_class = options[:printer_type_class]
end

Instance Attribute Details

#printablesObject (readonly)

Returns the value of attribute printables.



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

def printables
  @printables
end

Instance Method Details

#assetsObject



21
22
23
# File 'lib/label_printer/label/asset_redirect.rb', line 21

def assets
  printable_assets.each { |asset| asset.barcode! if asset.barcode_number.blank? }
end

#labelsObject



12
13
14
15
16
17
18
19
# File 'lib/label_printer/label/asset_redirect.rb', line 12

def labels
  case assets.first
  when Plate
    @printer_type_class.double_label? ? AssetPlateDouble.new(assets).labels : AssetPlate.new(assets).labels
  when Tube
    AssetTube.new(assets).labels
  end
end