Class: ActionPolicy::LookupChain::NamespaceCache
- Inherits:
-
Object
- Object
- ActionPolicy::LookupChain::NamespaceCache
- Defined in:
- lib/action_policy/lookup_chain.rb
Overview
Cache namespace resolving result for policies
Class Attribute Summary collapse
-
.store ⇒ Object
readonly
Returns the value of attribute store.
Class Method Summary collapse
Class Attribute Details
.store ⇒ Object (readonly)
Returns the value of attribute store.
21 22 23 |
# File 'lib/action_policy/lookup_chain.rb', line 21 def store @store end |
Class Method Details
.clear ⇒ Object
28 29 30 |
# File 'lib/action_policy/lookup_chain.rb', line 28 def clear @store = Hash.new { |h, k| h[k] = {} } end |
.fetch(namespace, policy) ⇒ Object
23 24 25 26 |
# File 'lib/action_policy/lookup_chain.rb', line 23 def fetch(namespace, policy) return store[namespace][policy] if store[namespace].key?(policy) store[namespace][policy] ||= yield end |