module Ciphers

Constants

LATIN
VERSION

Public Class Methods

alphabet_from(string) click to toggle source
# File lib/ciphers.rb, line 8
def self.alphabet_from(string)
  raise ArgumentError.new("Argument must be at most #{LATIN.length} characters long") unless string.length <= 26
  chars = string.upcase.chars
  raise ArgumentError.new("Argument must not contain duplicate letters") unless chars.uniq == chars
  if chars.length < 26
    chars + (LATIN - chars)
  else
    chars
  end
end