Exception: Policy::Follower::ViolationError
- Inherits:
-
RuntimeError
- Object
- RuntimeError
- Policy::Follower::ViolationError
- Defined in:
- lib/policy/follower/violation_error.rb
Overview
An exception to be risen when a follower violates its policy
Instance Attribute Summary collapse
-
#follower ⇒ Object
readonly
The follower object that causes the exception.
-
#policy ⇒ Policy::Base
readonly
The violated policy object.
Class Method Summary collapse
-
.initialize(follower, policy) ⇒ Policy::ViolationError
Constructs an exception for the policy violated by the follower.
Instance Method Summary collapse
-
#errors ⇒ ActiveModel::Errors
Returns the list of policy errors.
-
#inspect ⇒ String
The human-readable description for the exception.
-
#message ⇒ String
The human-readable exception message.
-
#new(follower, policy) ⇒ Policy::ViolationError
Constructs an exception for the policy violated by the follower.
Instance Attribute Details
#follower ⇒ Object (readonly)
The follower object that causes the exception
27 28 29 |
# File 'lib/policy/follower/violation_error.rb', line 27 def follower @follower end |
#policy ⇒ Policy::Base (readonly)
The violated policy object
33 34 35 |
# File 'lib/policy/follower/violation_error.rb', line 33 def policy @policy end |
Class Method Details
.initialize(follower, policy) ⇒ Policy::ViolationError
Constructs an exception for the policy violated by the follower
18 19 20 21 |
# File 'lib/policy/follower/violation_error.rb', line 18 def initialize(follower, policy) @follower = follower @policy = policy end |
Instance Method Details
#errors ⇒ ActiveModel::Errors
Returns the list of policy errors
38 39 40 |
# File 'lib/policy/follower/violation_error.rb', line 38 def errors policy.errors end |
#inspect ⇒ String
The human-readable description for the exception
52 53 54 |
# File 'lib/policy/follower/violation_error.rb', line 52 def inspect "#<#{ self }: #{ }>" end |
#message ⇒ String
The human-readable exception message
45 46 47 |
# File 'lib/policy/follower/violation_error.rb', line 45 def "#{ follower.inspect } violates the policy #{ policy }" end |
#new(follower, policy) ⇒ Policy::ViolationError
Constructs an exception for the policy violated by the follower
18 19 20 21 |
# File 'lib/policy/follower/violation_error.rb', line 18 def initialize(follower, policy) @follower = follower @policy = policy end |