module Pay::NanoId

Constants

ALPHABET

Generates unique IDs - faster than UUID

ALPHABET_SIZE

Public Class Methods

generate(size: 21) click to toggle source
# File lib/pay/nano_id.rb, line 7
def self.generate(size: 21)
  id = ""
  size.times { id << ALPHABET[(Random.rand * ALPHABET_SIZE).floor] }
  id
end