Class: Barby::GS1128

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

Overview

AKA EAN-128, UCC-128

Constant Summary

Constants inherited from Code128

Code128::CODEA, Code128::CODEB, Code128::CODEC, Code128::ENCODINGS, Code128::FNC1, Code128::FNC2, Code128::FNC3, Code128::FNC4, Code128::STOP, Code128::TERMINATE, Code128::VALUES

Instance Attribute Summary collapse

Attributes inherited from Code128

#type

Instance Method Summary collapse

Methods inherited from Code128

#change_code_encoding_for, #change_code_for, #change_code_for_class, #change_code_number_for, #characters, #checksum, #checksum_encoding, #class_for, #data=, #data_encoding, #data_encoding_with_extra_encoding, #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_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.



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

def initialize(data, type, ai)
  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.



9
10
11
# File 'lib/barby/barcode/gs1_128.rb', line 9

def application_identifier
  @application_identifier
end

Instance Method Details

#application_identifier_encodingObject



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

def application_identifier_encoding
  encodings[application_identifier_number]
end

#application_identifier_numberObject



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

def application_identifier_number
  values[application_identifier]
end

#dataObject

TODO: Not sure this is entirely right



18
19
20
# File 'lib/barby/barcode/gs1_128.rb', line 18

def data
  FNC1+application_identifier+super
end

#partial_dataObject



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

def partial_data
  @data
end

#to_sObject



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

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