Sha256: c63587ff39a87bb2e98a1534e83c52844da8da50f716d727cd701bc2f58000d3

Contents?: true

Size: 350 Bytes

Versions: 1

Compression:

Stored size: 350 Bytes

Contents

module Vindetta
  class Transliterator
    MAPPING = "0123456789.ABCDEFGH..JKLMN.P.R..STUVWXYZ".split("").freeze

    def self.vin(vin)
      vin.chars.map { |c| run(c) }
    end

    def self.run(character)
      index = MAPPING.find_index(character)
      raise Vindetta::InvalidCharacter, character unless index
      index % 10
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vindetta-0.17.1 lib/vindetta/transliterator.rb