Sha256: a50fd71c89f84dbca99753ea17eda1d55df4bb0e3693cedd911982e812782f39
Contents?: true
Size: 276 Bytes
Versions: 3
Compression:
Stored size: 276 Bytes
Contents
require 'base64' require 'digest/sha2' module Related module Helpers # Generate a unique id def generate_id Base64.encode64( Digest::SHA256.digest("#{Time.now}-#{rand}") ).gsub('/','x').gsub('+','y').gsub('=','').strip[0..21] end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
related-0.2.1 | lib/related/helpers.rb |
related-0.2 | lib/related/helpers.rb |
related-0.1 | lib/related/helpers.rb |