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



62
63
64
65
66
# File 'lib/action_policy/policy/cache.rb', line 62

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

#cached_rulesObject



68
69
70
71
72
73
74
75
76
77
# File 'lib/action_policy/policy/cache.rb', line 68

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