Sha256: 78b095c5ca03be6e6076d9b44ba59752d2f451402e24fa8b96eac8f168656a56

Contents?: true

Size: 445 Bytes

Versions: 4

Compression:

Stored size: 445 Bytes

Contents

module Imb

  class CodewordMap

    def initialize
      @characters = load_characters
    end

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

    private

    def load_characters
      YAML.load_file(characters_path)
    end

    def characters_path
      File.expand_path('codeword_to_character_mapping.yml',
                       File.dirname(__FILE__))
    end

  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
USPS-intelligent-barcode-0.2.0 lib/USPS-intelligent-barcode/CodewordMap.rb
USPS-intelligent-barcode-0.1.2 lib/USPS-intelligent-barcode/CodewordMap.rb
USPS-intelligent-barcode-0.1.1 lib/USPS-intelligent-barcode/CodewordMap.rb
USPS-intelligent-barcode-0.1.0 lib/USPS-intelligent-barcode/CodewordMap.rb