Module: Pragma::Operation::Authorization::ClassMethods
- Defined in:
- lib/pragma/operation/authorization.rb
Overview
:nodoc:
Instance Method Summary collapse
-
#policy(klass = nil) { ... } ⇒ Object
Sets the policy to use for authorizing this operation.
-
#policy_klass ⇒ Class
Returns the policy class.
Instance Method Details
#policy(klass = nil) { ... } ⇒ Object
Sets the policy to use for authorizing this operation.
20 21 22 23 24 25 26 |
# File 'lib/pragma/operation/authorization.rb', line 20 def policy(klass = nil, &block) if !klass && !block_given? fail ArgumentError, 'You must pass either a policy class or a block' end @policy = klass || block end |
#policy_klass ⇒ Class
Returns the policy class.
31 32 33 |
# File 'lib/pragma/operation/authorization.rb', line 31 def policy_klass @policy end |