Sha256: cc194fea30a7f1f9cac34f33007825dbbb8bf84f4649685cff092cffd1029825

Contents?: true

Size: 363 Bytes

Versions: 9

Compression:

Stored size: 363 Bytes

Contents

require 'base64'
require 'digest/md5'

module Related
  module Helpers

    # Generate a unique id
    def generate_id
      Base64.encode64(
        Digest::MD5.digest("#{Time.now}-#{rand}")
      ).gsub('/','x').gsub('+','y').gsub('=','').strip
    end

    # Returns the root node for the graph
    def root
      @root ||= Related::Root.new
    end

  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
related-0.6.6 lib/related/helpers.rb
related-0.6.5 lib/related/helpers.rb
related-0.6.4 lib/related/helpers.rb
related-0.6.3 lib/related/helpers.rb
related-0.6.2 lib/related/helpers.rb
related-0.6.1 lib/related/helpers.rb
related-0.6.0 lib/related/helpers.rb
related-0.5.0 lib/related/helpers.rb
related-0.4.0 lib/related/helpers.rb