Class: Imb::BarMap

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

Overview

Maps intelligent barcode “characters” to codes that indicate what type of bar to print at each given position.

Internal collapse

Constructor Details

#initializeBarMap

Returns a new instance of BarMap.



12
13
14
# File 'lib/USPS-intelligent-barcode/bar_map.rb', line 12

def initialize
  @mapping = load_mapping
end

Instance Method Details

#symbols(characters) ⇒ [BarSymbol]

Given an array of intelligent barcode “characters”, return an the symbols for each position.

Parameters:

  • characters ([Integer])

    array of characters

Returns:



21
22
23
24
25
# File 'lib/USPS-intelligent-barcode/bar_map.rb', line 21

def symbols(characters)
  @mapping.map do |bar_position|
    bar_position.map(characters)
  end
end