Project

General

Profile

Download (389 Bytes) Statistics
| Branch: | Tag: | Revision:
module AuthorizerCache
def initialize_cache
@cache = HashWithIndifferentAccess.new do |h, k|
h[k] = HashWithIndifferentAccess.new
end
end

def collection_cache_lookup(subject, permission)
collection = @cache[subject.class.to_s][permission] ||=
find_collection(subject.class, :permission => permission)

collection.include?(subject)
end
end
(4-4/47)