Class: Imb::CharacterPosition
- Inherits:
-
Object
- Object
- Imb::CharacterPosition
- Defined in:
- lib/USPS-intelligent-barcode/character_position.rb
Overview
Represents the position of one bit in the array of intelligent barcode “characters”.
Internal collapse
-
#extract_bit_from_characters(characters) ⇒ Integer
Given an array of characters, return the bit for this position.
-
#initialize(character_index, bit_number) ⇒ CharacterPosition
constructor
A new instance of CharacterPosition.
Constructor Details
#initialize(character_index, bit_number) ⇒ CharacterPosition
Returns a new instance of CharacterPosition.
13 14 15 16 |
# File 'lib/USPS-intelligent-barcode/character_position.rb', line 13 def initialize(character_index, bit_number) @character_index = character_index @bit_number = bit_number end |
Instance Method Details
#extract_bit_from_characters(characters) ⇒ Integer
Given an array of characters, return the bit for this position.
22 23 24 |
# File 'lib/USPS-intelligent-barcode/character_position.rb', line 22 def extract_bit_from_characters(characters) characters[@character_index][@bit_number] end |