class At_email::Formatting
Public Class Methods
new()
click to toggle source
# File lib/at_email.rb, line 184 def initialize end
Public Instance Methods
get_hash(data, hash_length)
click to toggle source
# File lib/at_email.rb, line 187 def get_hash(data, hash_length) if !hash_length.is_a? Numeric $logger.event('FATAL', 'FATAL ERROR', 'hash_length variable is not numeric') return false end if (hash_length > 32) $logger.event('FATAL', 'FATAL ERROR', 'hash_length maximum limit is 32 - Requested length: ' + hash_length.to_s) return false end return Digest::MD5.hexdigest(data)[0...hash_length] end
get_random_id(id_length)
click to toggle source
# File lib/at_email.rb, line 199 def get_random_id(id_length) hash = get_hash(Time.now.to_f.to_s + '-' + rand(1..1000000000000).to_s, id_length) if hash return hash else return false end end