Class: CanTango::Ability::Cache::RulesCache

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(session = nil) ⇒ RulesCache

Returns a new instance of RulesCache.



11
12
13
# File 'lib/cantango/ability/cache/rules_cache.rb', line 11

def initialize session = nil
  @session = session
end

Instance Attribute Details

#sessionObject (readonly)

Returns the value of attribute session.



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

def session
  @session
end

Instance Method Details

#cache_optionsObject



19
20
21
# File 'lib/cantango/ability/cache/rules_cache.rb', line 19

def cache_options
  cache_engine.store.options || {}
end

#clazzObject



23
24
25
# File 'lib/cantango/ability/cache/rules_cache.rb', line 23

def clazz
  cache_engine.store.default_class
end

#instanceObject



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

def instance
  @instance ||= clazz.new :rules_cache, options
end

#optionsObject



15
16
17
# File 'lib/cantango/ability/cache/rules_cache.rb', line 15

def options
  @options ||= session ? cache_options.merge(:session => session) : cache_options
end