Module: ActionPolicy::Policy::Cache::ClassMethods

Defined in:
lib/action_policy/policy/cache.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#cache(*rules, **options) ⇒ Object



55
56
57
58
59
# File 'lib/action_policy/policy/cache.rb', line 55

def cache(*rules, **options)
  rules.each do |rule|
    cached_rules[rule] = options
  end
end

#cached_rulesObject



61
62
63
64
65
66
67
68
69
70
# File 'lib/action_policy/policy/cache.rb', line 61

def cached_rules
  return @cached_rules if instance_variable_defined?(:@cached_rules)

  @cached_rules =
    if superclass.respond_to?(:cached_rules)
      superclass.cached_rules.dup
    else
      {}
    end
end