Exception: Moat::NotAuthorizedError
- Defined in:
- lib/moat.rb
Instance Attribute Summary collapse
-
#action ⇒ Object
readonly
Returns the value of attribute action.
-
#policy ⇒ Object
readonly
Returns the value of attribute policy.
-
#resource ⇒ Object
readonly
Returns the value of attribute resource.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ NotAuthorizedError
constructor
A new instance of NotAuthorizedError.
Constructor Details
#initialize(options = {}) ⇒ NotAuthorizedError
Returns a new instance of NotAuthorizedError.
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/moat.rb', line 26 def initialize( = {}) return super if .is_a?(String) @action = [:action] @resource = [:resource] @policy = [:policy] @user = [:user] = .fetch(:message) { "unauthorized #{policy.name}##{action} for #{resource}" } super() end |
Instance Attribute Details
#action ⇒ Object (readonly)
Returns the value of attribute action.
24 25 26 |
# File 'lib/moat.rb', line 24 def action @action end |
#policy ⇒ Object (readonly)
Returns the value of attribute policy.
24 25 26 |
# File 'lib/moat.rb', line 24 def policy @policy end |
#resource ⇒ Object (readonly)
Returns the value of attribute resource.
24 25 26 |
# File 'lib/moat.rb', line 24 def resource @resource end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
24 25 26 |
# File 'lib/moat.rb', line 24 def user @user end |