Module: ActionPolicy

Defined in:
lib/action_policy.rb,
lib/action_policy/base.rb,
lib/action_policy/railtie.rb,
lib/action_policy/testing.rb,
lib/action_policy/version.rb,
lib/action_policy/behaviour.rb,
lib/action_policy/authorizer.rb,
lib/action_policy/policy/core.rb,
lib/action_policy/test_helper.rb,
lib/action_policy/lookup_chain.rb,
lib/action_policy/policy/cache.rb,
lib/action_policy/rails/channel.rb,
lib/action_policy/policy/aliases.rb,
lib/action_policy/policy/reasons.rb,
lib/action_policy/policy/defaults.rb,
lib/action_policy/cache_middleware.rb,
lib/action_policy/ext/string_match.rb,
lib/action_policy/policy/pre_check.rb,
lib/action_policy/rails/controller.rb,
lib/action_policy/behaviours/memoized.rb,
lib/action_policy/ext/yield_self_then.rb,
lib/action_policy/policy/cached_apply.rb,
lib/action_policy/rspec/pundit_syntax.rb,
lib/action_policy/ext/module_namespace.rb,
lib/action_policy/ext/policy_cache_key.rb,
lib/action_policy/policy/authorization.rb,
lib/action_policy/behaviours/namespaced.rb,
lib/action_policy/behaviours/policy_for.rb,
lib/action_policy/ext/string_underscore.rb,
lib/action_policy/ext/string_constantize.rb,
lib/action_policy/rspec/be_authorized_to.rb,
lib/action_policy/policy/execution_result.rb,
lib/action_policy/behaviours/thread_memoized.rb

Overview

:nodoc:

Defined Under Namespace

Modules: Authorizer, Behaviour, Behaviours, Channel, Controller, Ext, LookupChain, PerThreadCache, Policy, RSpec, TestHelper, Testing Classes: AuthorizationContextMissing, Base, CacheMiddleware, Error, NotFound, Railtie, Unauthorized, UnauthorizedAction, UnknownRule

Constant Summary collapse

VERSION =
"0.2.3"
CACHE_NAMESPACE =

By default cache namespace (or prefix) contains major and minor version of the gem

"acp:#{ActionPolicy::VERSION.split('.').take(2).join('.')}"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.cache_storeObject

Returns the value of attribute cache_store.



27
28
29
# File 'lib/action_policy.rb', line 27

def cache_store
  @cache_store
end

Class Method Details

.lookup(target, **options) ⇒ Object

Find a policy class for a target



30
31
32
33
# File 'lib/action_policy.rb', line 30

def lookup(target, **options)
  LookupChain.call(target, options) ||
    raise(NotFound, target)
end