Sha256: db1072c2e11959f10d2167c55ad0eee8eebce4dadf4977502b49707b8cda23a0

Contents?: true

Size: 360 Bytes

Versions: 1

Compression:

Stored size: 360 Bytes

Contents

module Vindetta
  class Transliterator
    MAPPING = "0123456789.ABCDEFGH..JKLMN.P.R..STUVWXYZ".chars

    def self.vin(vin)
      vin.chars.map do |c|
        index = MAPPING.find_index(c)
        raise Vindetta::InvalidCharacter, c unless index
        index % 10
      end
    end

    def self.run(character)
      vin(character.to_s)[0]
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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