Class: Barcodes::Symbology::Code39
- Defined in:
- lib/barcodes/symbology/code39.rb
Overview
This class represents the Code 39 symbology. Code 39 can encode the numbers 0-9 and all capital letters along with the following symbols: ‘ ’,‘-’, ‘.’,‘$’,‘/’,‘+’,‘%’,‘*’
More info: en.wikipedia.org/wiki/Code_39
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from Base
#alpha, #bar_height, #bar_width, #caption_height, #caption_size, #captioned, #color, #data
Class Method Summary collapse
-
.charset ⇒ Object
The Code 39 character set.
-
.valueset ⇒ Object
The Code 39 values set.
Instance Method Summary collapse
-
#caption_data ⇒ Object
Code 39 includes the start and stop symbols in the caption so caption_data is overridden here to return the formatted data string.
-
#formatted_data ⇒ Object
Start character + data + stop character.
-
#initialize(args = {}) ⇒ Code39
constructor
Creates a new Code39 instance.
Methods inherited from Base
#encoded_data, #height, #quiet_zone_width, #valid?, #width
Constructor Details
#initialize(args = {}) ⇒ Code39
Creates a new Code39 instance.
49 50 51 52 53 54 |
# File 'lib/barcodes/symbology/code39.rb', line 49 def initialize(args={}) super(args) @start_character = '*' @stop_character = '*' end |
Class Method Details
.charset ⇒ Object
The Code 39 character set
21 22 23 24 25 26 27 28 29 |
# File 'lib/barcodes/symbology/code39.rb', line 21 def self.charset [ '0','1','2','3','4','5','6','7','8','9', 'A','B','C','D','E','F','G','H','I','J', 'K','L','M','N','O','P','Q','R','S','T', 'U','V','W','X','Y','Z',' ','-','.','$', '/','+','%','*' ].collect {|c| c.bytes.to_a[0] } end |
.valueset ⇒ Object
The Code 39 values set
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/barcodes/symbology/code39.rb', line 32 def self.valueset [ "1010011011010","1101001010110","1011001010110","1101100101010", "1010011010110","1010011010110","1011001101010","1011001101010", "1101001011010","1011001011010","1101010010110","1011010010110", "1101101001010","1010110010110","1101011001010","1011011001010", "1010100110110","1101010011010","1011010011010","1010110011010", "1101010100110","1011010100110","1101101010010","1010110100110", "1101011010010","1011011010010","1010101100110","1101010110010", "1011010110010","1010110110010","1100101010110","1001101010110", "1100110101010","1001011010110","1100101101010","1001101101010", "1001101011010","1001010110110","1100101011010","1001001001010", "1001001010010","1001010010010","1010010010010","1001011011010" ] end |
Instance Method Details
#caption_data ⇒ Object
Code 39 includes the start and stop symbols in the caption so caption_data is overridden here to return the formatted data string
59 60 61 |
# File 'lib/barcodes/symbology/code39.rb', line 59 def caption_data self.formatted_data end |
#formatted_data ⇒ Object
Start character + data + stop character
64 65 66 |
# File 'lib/barcodes/symbology/code39.rb', line 64 def formatted_data @start_character + @data + @stop_character end |