Class: Barcodes::Symbology::Code93Extended

Inherits:
Code93
  • Object
show all
Defined in:
lib/barcodes/symbology/code93extended.rb

Overview

This class represents the Code 93 Extended symbology. Code 93 Extended can encode all standard ASCII characters.

More info: en.wikipedia.org/wiki/Code_93

Instance Attribute Summary

Attributes inherited from Base

#alpha, #bar_height, #bar_width, #caption_height, #caption_size, #captioned, #color, #data

Instance Method Summary collapse

Methods inherited from Code93

#caption_data, charset, #initialize, valueset

Methods inherited from Base

#caption_data, charset, #encoded_data, #height, #initialize, #quiet_zone_width, valueset, #width

Constructor Details

This class inherits a constructor from Barcodes::Symbology::Code93

Instance Method Details

#checksumObject

Calculates the C and K checksum values



27
28
29
30
31
32
33
34
# File 'lib/barcodes/symbology/code93extended.rb', line 27

def checksum
  if self.valid?
    data = self._data
    c_value = self._checksum(data, 20)
    k_value = self._checksum(data + c_value, 15)
    return c_value + k_value
  end
end

#formatted_dataObject

Start character + data + checksum + stop character



19
20
21
22
23
24
# File 'lib/barcodes/symbology/code93extended.rb', line 19

def formatted_data
  checksum = self.checksum
  unless checksum.nil?
    @start_character + self._data + checksum + @stop_character
  end
end

#valid?Boolean

Validates the data

Returns:

  • (Boolean)


37
38
39
# File 'lib/barcodes/symbology/code93extended.rb', line 37

def valid?
  return !self._data.nil?
end