Class: Languages::Zpl2::BarcodeFactory

Inherits:
Object
  • Object
show all
Defined in:
lib/languages/zpl2/barcode.rb

Class Method Summary collapse

Class Method Details

.create_barcode(code_type, opts = {}) ⇒ Object



4
5
6
7
8
9
10
11
12
# File 'lib/languages/zpl2/barcode.rb', line 4

def self.create_barcode(code_type, opts = {})
  if Barcode1D::BarcodeClasses.keys.include? code_type
    Barcode1D.new code_type,opts
  elsif Barcode2D::BarcodeClasses.keys.include? code_type
    Barcode2D.new code_type,opts
  else
    raise ArgumentException.new("Unknown barcode: #{code_type}")
  end
end