Class: Imb::BarPosition

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

Overview

Represents a position (one line) in the barcode. This class is internal and may change.

Internal collapse

Constructor Details

#initialize(descender_character_position, ascender_character_position) ⇒ BarPosition

Returns a new instance of BarPosition.

Parameters:



13
14
15
16
# File 'lib/USPS-intelligent-barcode/bar_position.rb', line 13

def initialize(descender_character_position, ascender_character_position)
  @descender_character_position = descender_character_position
  @ascender_character_position = ascender_character_position
end

Instance Method Details

#map(characters) ⇒ BarSymbol

Given an array of characters, return a symbol for this barcode position.

Parameters:

  • characters ([Integer])

    character codes

Returns:



23
24
25
26
# File 'lib/USPS-intelligent-barcode/bar_position.rb', line 23

def map(characters)
  BarSymbol.make(ascender_bit(characters),
                 descender_bit(characters))
end