Sha256: 2ed4244df9b876f95f89717d6fc59444a4f2d3507cbaa811abdcac8aa57d8cd7
Contents?: true
Size: 265 Bytes
Versions: 2
Compression:
Stored size: 265 Bytes
Contents
require 'base62' module Tincan module Utils module_function def generate_code(length = 8) SecureRandom.random_bytes((length / 2.0).ceil).unpack('C*').map do |int| int.base62_encode.rjust 2, '0' end.join[0...length] end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
tincan-0.1.6 | lib/tincan/utils.rb |
tincan-0.1.5 | lib/tincan/utils.rb |