Exception: SafetyPatrol::Padrino::SafteyViolation
- Inherits:
-
StandardError
- Object
- StandardError
- SafetyPatrol::Padrino::SafteyViolation
- Defined in:
- lib/safety_patrol/padrino/safety_violation.rb
Instance Attribute Summary collapse
-
#action ⇒ Object
readonly
Returns the value of attribute action.
-
#resource ⇒ Object
readonly
Returns the value of attribute resource.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Instance Method Summary collapse
-
#initialize(user, action, resource) ⇒ SafteyViolation
constructor
A new instance of SafteyViolation.
- #message ⇒ Object
Constructor Details
#initialize(user, action, resource) ⇒ SafteyViolation
Returns a new instance of SafteyViolation.
9 10 11 12 13 |
# File 'lib/safety_patrol/padrino/safety_violation.rb', line 9 def initialize(user, action, resource) @user = user @action = action @resource = resource end |
Instance Attribute Details
#action ⇒ Object (readonly)
Returns the value of attribute action.
7 8 9 |
# File 'lib/safety_patrol/padrino/safety_violation.rb', line 7 def action @action end |
#resource ⇒ Object (readonly)
Returns the value of attribute resource.
7 8 9 |
# File 'lib/safety_patrol/padrino/safety_violation.rb', line 7 def resource @resource end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
7 8 9 |
# File 'lib/safety_patrol/padrino/safety_violation.rb', line 7 def user @user end |
Instance Method Details
#message ⇒ Object
15 16 17 |
# File 'lib/safety_patrol/padrino/safety_violation.rb', line 15 def "#{@user.class} is not authorized to #{@action} this resource: #{@resource.class}" end |