Sha256: a04da284051962d243b056d9c7174d6a8fad65b198657f04dac237241c1ce3d5

Contents?: true

Size: 426 Bytes

Versions: 1

Compression:

Stored size: 426 Bytes

Contents

require "digest/md5"
require 'uri'

module Kernel
  def qor_cache_key(*names, &blk)
    objs = names.map { |name| Qor::Cache::Configuration.first(:cache_key, name).block.call }
    objs << instance_eval(&blk) if block_given?

    results = objs.flatten.map do |obj|
      obj.respond_to?(:cache_key) ? obj.cache_key : obj.inspect
    end

    Digest::MD5.hexdigest(results.join("-"))
  rescue
    puts $!
    rand()
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
qor_cache-0.0.3 lib/qor_cache/kernel.rb