Class: CanTango::Ability::Cache::Reader

Inherits:
Object
  • Object
show all
Includes:
Helpers::Debug
Defined in:
lib/cantango/ability/cache/reader.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Helpers::Debug

#debug

Constructor Details

#initialize(cache) ⇒ Reader

Returns a new instance of Reader.



9
10
11
# File 'lib/cantango/ability/cache/reader.rb', line 9

def initialize cache
  @cache = cache
end

Instance Attribute Details

#cacheObject (readonly)

Returns the value of attribute cache.



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

def cache
  @cache
end

Instance Method Details

#prepared_rulesObject



13
14
15
16
# File 'lib/cantango/ability/cache/reader.rb', line 13

def prepared_rules
  debug "reading rules from cache: #{cache.key}"
  cache.compile_on? ? compiler.decompile!(loaded_rules) : loaded_rules
end