Module: Zebra::Zpl::BarcodeType

Defined in:
lib/zebra/zpl/barcode_type.rb

Defined Under Namespace

Classes: InvalidBarcodeTypeError

Constant Summary collapse

CODE_39 =
"3"
CODE_93 =
"A"
CODE_128_AUTO =
"C"
CODABAR =
"K"
CODE_AZTEC =
"0"
CODE_AZTEC_PARAMS =
"O"
CODE_UPS_MAXICODE =
"D"
CODE_QR =
"Q"

Class Method Summary collapse

Class Method Details

.valid_barcode_type?(type) ⇒ Boolean

Legacy (EPL) bar code suffixes CODE_39 = “3” CODE_39_CHECK_DIGIT = “3C” CODE_93 = “9” CODE_128_AUTO = “1” CODE_128_A = “1A” CODE_128_B = “1B” CODE_128_C = “1C” CODABAR = “K”

Returns:

  • (Boolean)


25
26
27
# File 'lib/zebra/zpl/barcode_type.rb', line 25

def self.valid_barcode_type?(type)
  %w(3 A C K 0 O D Q).include? type
end

.validate_barcode_type(type) ⇒ Object



29
30
31
# File 'lib/zebra/zpl/barcode_type.rb', line 29

def self.validate_barcode_type(type)
  raise InvalidBarcodeTypeError unless valid_barcode_type?(type)
end