module Frostyid::Generator

The generator module containing the default generator.

Public Class Methods

generate_id(options) click to toggle source
# File lib/frostyid.rb, line 11
def self.generate_id(options)
  "#{format("%0#{options[:timestamp_length]}s", (Time.now - options[:epoch]).to_i.to_s(36))}#{format("%0#{options[:random_length]}s", rand(36**options[:random_length]).to_s(36))}".gsub(' ', '0')
end