Class: Imb::BarSymbol
- Inherits:
-
Object
- Object
- Imb::BarSymbol
- Defined in:
- lib/USPS-intelligent-barcode/bar_symbol.rb
Overview
Represents a symbol in the barcode.
Internal collapse
-
#code ⇒ Integer
readonly
The code for this symbol.
-
#letter ⇒ String
readonly
The letter for this symbol.
Internal collapse
- .make(ascender_bit, descender_bit) ⇒ BarSymbol
-
#initialize(code, letter) ⇒ BarSymbol
constructor
A new instance of BarSymbol.
Constructor Details
#initialize(code, letter) ⇒ BarSymbol
Returns a new instance of BarSymbol.
35 36 37 38 |
# File 'lib/USPS-intelligent-barcode/bar_symbol.rb', line 35 def initialize(code, letter) @code = code @letter = letter end |
Instance Attribute Details
#code ⇒ Integer (readonly)
Returns the code for this symbol.
27 28 29 |
# File 'lib/USPS-intelligent-barcode/bar_symbol.rb', line 27 def code @code end |
#letter ⇒ String (readonly)
Returns the letter for this symbol.
30 31 32 |
# File 'lib/USPS-intelligent-barcode/bar_symbol.rb', line 30 def letter @letter end |
Class Method Details
.make(ascender_bit, descender_bit) ⇒ BarSymbol
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/USPS-intelligent-barcode/bar_symbol.rb', line 13 def self.make(ascender_bit, descender_bit) case [ascender_bit, descender_bit] when [0, 0] TRACKER when [0, 1] DESCENDER when [1, 0] ASCENDER when [1, 1] FULL end end |