Class: Barcodes::Symbology::Msi

Inherits:
Base
  • Object
show all
Defined in:
lib/barcodes/symbology/msi.rb

Overview

This class represents the MSI symbology MSI can encode only numbers 0-9

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

Direct Known Subclasses

MsiMod10, MsiMod11

Instance Attribute Summary

Attributes inherited from Base

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

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#caption_data, #encoded_data, #height, #quiet_zone_width, #valid?, #width

Constructor Details

#initialize(args = {}) ⇒ Msi

Creates a new Msi instance



33
34
35
36
37
38
# File 'lib/barcodes/symbology/msi.rb', line 33

def initialize(args={})
  super(args)
  
  @start_character = 'S'
  @stop_character = 'E'
end

Class Method Details

.charsetObject

MSI character set



19
20
21
# File 'lib/barcodes/symbology/msi.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

.valuesetObject

MSI values set



24
25
26
27
28
29
30
# File 'lib/barcodes/symbology/msi.rb', line 24

def self.valueset
  [
    '100100100100','100100100110','100100110100','100100110110',
    '100110100100','100110100110','100110110100','100110110110',
    '110100100100','110100100110','110','1001'
  ]
end

Instance Method Details

#formatted_dataObject

Returns start character + data + stop character



41
42
43
# File 'lib/barcodes/symbology/msi.rb', line 41

def formatted_data
  @start_character + @data + @stop_character
end