Class: CanTango::Ability::Cache::Writer

Inherits:
Object
  • Object
show all
Defined in:
lib/cantango/ability/cache/writer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(cache) ⇒ Writer

Returns a new instance of Writer.



7
8
9
# File 'lib/cantango/ability/cache/writer.rb', line 7

def initialize cache
  @cache = cache
end

Instance Attribute Details

#cacheObject (readonly)

Returns the value of attribute cache.



5
6
7
# File 'lib/cantango/ability/cache/writer.rb', line 5

def cache
  @cache
end

Instance Method Details

#save(key, rules) ⇒ Object



11
12
13
14
15
# File 'lib/cantango/ability/cache/writer.rb', line 11

def save key, rules
  cache.invalidate!
  cache.rules_cache.save cache.key, prepared_rules
  session[:cache_key] = cache.key if session
end