Class: Critic::Authorization
- Inherits:
-
Object
- Object
- Critic::Authorization
- Defined in:
- lib/critic/authorization.rb
Instance Attribute Summary collapse
-
#action ⇒ Object
readonly
Returns the value of attribute action.
-
#granted ⇒ Object
Returns the value of attribute granted.
-
#messages ⇒ Object
Returns the value of attribute messages.
-
#metadata ⇒ Object
Returns the value of attribute metadata.
-
#policy ⇒ Object
readonly
Returns the value of attribute policy.
-
#result ⇒ Object
Returns the value of attribute result.
Instance Method Summary collapse
- #denied? ⇒ Boolean
- #granted? ⇒ Boolean
-
#initialize(policy, action) ⇒ Authorization
constructor
A new instance of Authorization.
Constructor Details
#initialize(policy, action) ⇒ Authorization
Returns a new instance of Authorization.
6 7 8 9 10 11 12 13 |
# File 'lib/critic/authorization.rb', line 6 def initialize(policy, action) @policy = policy @action = action&.to_sym @metadata = {} @granted, @result = nil @messages = [] end |
Instance Attribute Details
#action ⇒ Object (readonly)
Returns the value of attribute action.
3 4 5 |
# File 'lib/critic/authorization.rb', line 3 def action @action end |
#granted ⇒ Object
Returns the value of attribute granted.
4 5 6 |
# File 'lib/critic/authorization.rb', line 4 def granted @granted end |
#messages ⇒ Object
Returns the value of attribute messages.
4 5 6 |
# File 'lib/critic/authorization.rb', line 4 def @messages end |
#metadata ⇒ Object
Returns the value of attribute metadata.
4 5 6 |
# File 'lib/critic/authorization.rb', line 4 def @metadata end |
#policy ⇒ Object (readonly)
Returns the value of attribute policy.
3 4 5 |
# File 'lib/critic/authorization.rb', line 3 def policy @policy end |
#result ⇒ Object
Returns the value of attribute result.
4 5 6 |
# File 'lib/critic/authorization.rb', line 4 def result @result end |
Instance Method Details
#denied? ⇒ Boolean
19 20 21 |
# File 'lib/critic/authorization.rb', line 19 def denied? false == @granted end |
#granted? ⇒ Boolean
15 16 17 |
# File 'lib/critic/authorization.rb', line 15 def granted? true == @granted end |