Class: Barby::GS1128

Inherits:
Code128 show all
Defined in:
lib/barby/barcode/gs1_128.rb

Overview

DEPRECATED - Use the Code128 class directly instead:

Code128.new("#{Code128::FNC1}#{application_identifier}#{data}")

AKA EAN-128, UCC-128

Constant Summary

Constants inherited from Code128

Code128::CODEA, Code128::CODEB, Code128::CODEC, Code128::CODEC_CHARS_RE, Code128::CONTROL_CHARACTERS, Code128::CTRL_RE, Code128::DGTS_RE, Code128::ENCODINGS, Code128::FNC1, Code128::FNC2, Code128::FNC3, Code128::FNC4, Code128::LOWR_RE, Code128::SHIFT, Code128::STARTA, Code128::STARTB, Code128::STARTC, Code128::STOP, Code128::TERMINATE, Code128::VALUES

Instance Attribute Summary collapse

Attributes inherited from Code128

#type

Instance Method Summary collapse

Methods inherited from Code128

apply_shortest_encoding_for_data, #change_code_encoding_for, #change_code_for, #change_code_for_class, #change_code_number_for, #characters, #checksum, #checksum_encoding, class_for, #class_for, #data=, #data_encoding, #data_encoding_with_extra_encoding, determine_best_type_for_data, #encoding, #encoding_for, #encodings, #extra, #extra=, #extra_encoding, #extra_numbers, #full_data, #full_data_with_change_codes, #full_extra_data, #full_extra_data_with_change_code, #numbers, #start_character, #start_encoding, #start_num, #stop_encoding, #valid?, #values

Methods inherited from Barcode

#encoding, #method_missing, #outputter_class_for, #outputter_for, outputters, register_outputter, #two_dimensional?, #valid?

Constructor Details

#initialize(data, type, ai) ⇒ GS1128

Returns a new instance of GS1128.



15
16
17
18
19
# File 'lib/barby/barcode/gs1_128.rb', line 15

def initialize(data, type, ai)
  warn "DEPRECATED: The GS1128 class has been deprecated, use Code128 directly instead (called from #{caller[0]})"
  self.application_identifier = ai
  super(data, type)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Barby::Barcode

Instance Attribute Details

#application_identifierObject

Returns the value of attribute application_identifier.



13
14
15
# File 'lib/barby/barcode/gs1_128.rb', line 13

def application_identifier
  @application_identifier
end

Instance Method Details

#application_identifier_encodingObject



34
35
36
# File 'lib/barby/barcode/gs1_128.rb', line 34

def application_identifier_encoding
  encodings[application_identifier_number]
end

#application_identifier_numberObject



30
31
32
# File 'lib/barby/barcode/gs1_128.rb', line 30

def application_identifier_number
  values[application_identifier]
end

#dataObject



22
23
24
# File 'lib/barby/barcode/gs1_128.rb', line 22

def data
  FNC1+application_identifier+super
end

#partial_dataObject



26
27
28
# File 'lib/barby/barcode/gs1_128.rb', line 26

def partial_data
  @data
end

#to_sObject



38
39
40
# File 'lib/barby/barcode/gs1_128.rb', line 38

def to_s
  "(#{application_identifier}) #{partial_data}"
end