module PromocodeGenerator

Constants

VERSION

Public Class Methods

generate(length = 8) click to toggle source

Generates an 8 character random code of uppercase letters and numbers It explicitly excludes the letters I, L, O and the number 0 to avoid confusion

# File lib/promocode_generator.rb, line 9
def self.generate(length = 8)
  [('A'..'Z').to_a - ['I', 'L', 'O'], ('1'..'9').to_a].flatten.shuffle[0,length].join
end