Class: Imb::CodewordMap

Inherits:
Object
  • Object
show all
Defined in:
lib/USPS-intelligent-barcode/codeword_map.rb

Overview

Maps codewords to characters.

Internal collapse

Constructor Details

#initializeCodewordMap

Constructor



11
12
13
# File 'lib/USPS-intelligent-barcode/codeword_map.rb', line 11

def initialize
  @characters = load_characters
end

Instance Method Details

#characters(codewords) ⇒ [Integer]

Given an array of codewords, ruturn their characters.

Parameters:

  • codewords ([Integer])

Returns:

  • ([Integer])

    Array of characters



19
20
21
22
23
# File 'lib/USPS-intelligent-barcode/codeword_map.rb', line 19

def characters(codewords)
  codewords.map do |codeword|
    @characters[codeword]
  end
end