Class: Critic::AuthorizationDenied

Inherits:
Error
  • Object
show all
Defined in:
lib/critic/authorization_denied.rb

Overview

Custom error class for authorization failures

Constant Summary collapse

DEFAULT_MESSAGE =
'Authorization denied'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(authorization) ⇒ AuthorizationDenied

Returns a new instance of AuthorizationDenied.



8
9
10
11
12
13
14
15
16
17
# File 'lib/critic/authorization_denied.rb', line 8

def initialize(authorization)
  @authorization = authorization

  message = if authorization.messages.any?
              authorization.messages.join(',')
            else
              DEFAULT_MESSAGE
            end
  super(message)
end

Instance Attribute Details

#authorizationObject (readonly)

Returns the value of attribute authorization.



6
7
8
# File 'lib/critic/authorization_denied.rb', line 6

def authorization
  @authorization
end