Sha256: c91412505800b859d1b8ea8914e9e841487106f0598b0b7890015e4eb40b919c

Contents?: true

Size: 758 Bytes

Versions: 8

Compression:

Stored size: 758 Bytes

Contents

module CanTango
  class Ability
    class Cache
      class RulesCache
        attr_reader :session

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

        def initialize session = nil
          @session = session
        end

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

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

        def clazz
          cache_engine.store.default_class
        end

        protected

        def cache_engine
          raise "Cache engine not registered!" if !CanTango.config.engine(:cache)
          CanTango.config.engine(:cache)
        end
      end
    end
  end
end


Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
cantango-0.9.4.7 lib/cantango/ability/cache/rules_cache.rb
cantango-0.9.4.6 lib/cantango/ability/cache/rules_cache.rb
cantango-0.9.4.5 lib/cantango/ability/cache/rules_cache.rb
cantango-0.9.4.3 lib/cantango/ability/cache/rules_cache.rb
cantango-0.9.4.2 lib/cantango/ability/cache/rules_cache.rb
cantango-0.9.4.1 lib/cantango/ability/cache/rules_cache.rb
cantango-0.9.4 lib/cantango/ability/cache/rules_cache.rb
cantango-0.9.3.2 lib/cantango/ability/cache/rules_cache.rb