Sha256: 84fa9809fc27b54c3b1af5a604013b6343ee6513b7124062436316a8118fa58e
Contents?: true
Size: 419 Bytes
Versions: 3
Compression:
Stored size: 419 Bytes
Contents
require "digest/md5" module Kernel def qor_cache_key(*names, &blk) objs = names.map { |name| Qor::Cache::Configuration.first(:cache_key, name).block.call } objs << blk.call if block_given? results = objs.map do |obj| Array(obj).map {|x| x.respond_to?(:cache_key) ? x.cache_key : x.inspect }.join("-") end Digest::MD5.hexdigest(results.join("-")) rescue puts $! rand() end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
qor_cache-0.0.4 | lib/qor_cache/kernel.rb |
qor_cache-0.0.2 | lib/qor_cache/kernel.rb |
qor_cache-0.0.1 | lib/qor_cache/kernel.rb |