Class: Barcodes::Symbology::Standard2Of5
- Defined in:
- lib/barcodes/symbology/standard2of5.rb
Overview
This class represents the Standard 2 of 5 symbology Standard 2 of 5 can encode only numbers 0-9
More info: en.wikipedia.org/wiki/Two-out-of-five_code
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
Standard 2 of 5 character set.
-
.valueset ⇒ Object
Standard 2 of 5 values set.
Instance Method Summary collapse
-
#formatted_data ⇒ Object
Returns start character + data + stop character.
-
#initialize(args = {}) ⇒ Standard2Of5
constructor
Creates a new Standard2Of5 instance.
Methods inherited from Base
#caption_data, #encoded_data, #height, #quiet_zone_width, #valid?, #width
Constructor Details
#initialize(args = {}) ⇒ Standard2Of5
Creates a new Standard2Of5 instance
33 34 35 36 37 38 |
# File 'lib/barcodes/symbology/standard2of5.rb', line 33 def initialize(args={}) super(args) @start_character = 'S' @stop_character = 'E' end |
Class Method Details
.charset ⇒ Object
Standard 2 of 5 character set
19 20 21 |
# File 'lib/barcodes/symbology/standard2of5.rb', line 19 def self.charset ['0','1','2','3','4','5','6','7','8','9','S','E'].collect {|c| c.bytes.to_a[0] } end |
.valueset ⇒ Object
Standard 2 of 5 values set
24 25 26 27 28 29 30 |
# File 'lib/barcodes/symbology/standard2of5.rb', line 24 def self.valueset [ '10101110111010','11101010101110','10111010101110','11101110101010', '10101110101110','11101011101010','10111011101010','10101011101110', '11101010111010','10111010111010','11011010','1101011' ] end |
Instance Method Details
#formatted_data ⇒ Object
Returns start character + data + stop character
41 42 43 |
# File 'lib/barcodes/symbology/standard2of5.rb', line 41 def formatted_data @start_character + @data + @stop_character end |