Sha256: 81d12909d295ddc5db9e9a721c0c101bc85add1effb9ae849d4f032908d30bcd
Contents?: true
Size: 541 Bytes
Versions: 7
Compression:
Stored size: 541 Bytes
Contents
require 'dm-core' require 'digest/sha1' module DataMapper class Property class APIKey < String # The amount of random seed data to use to generate tha API Key PADDING = 256 length 40 unique true default proc { APIKey.generate } # # Generates a new API Key. # # @return [String] # The new API Key. # def self.generate sha1 = Digest::SHA1.new PADDING.times { sha1 << rand(256).chr } return sha1.hexdigest end end end end
Version data entries
7 entries across 7 versions & 2 rubygems