module Maini::Utils::ActiveRecord::RandomString
Public Class Methods
included(base)
click to toggle source
# File lib/maini/utils/active_record/random_string.rb, line 9 def self.included(base) base.extend ClassMethods end
random_string(type, opts = {})
click to toggle source
# File lib/maini/utils/active_record/random_string.rb, line 13 def self.random_string(type, opts = {}) case type.to_sym when :uuid SecureRandom.uuid when :chars Maini::Utils::RandomString.generate(opts) else SecureRandom.hex(opts[:length] || 24) end end