Exception: Policy::ViolationError
- Inherits:
-
RuntimeError
- Object
- RuntimeError
- Policy::ViolationError
- Includes:
- Adamantium
- Defined in:
- lib/policy/violation_error.rb
Overview
An exception to be risen by Interface#apply
Instance Attribute Summary collapse
-
#messages ⇒ Array<String>
readonly
The list of messages from the broken policy.
-
#policy ⇒ Policy::Follower
readonly
The violated policy object.
Class Method Summary collapse
-
.initialize(policy) ⇒ Policy::ViolationError
Constructs an exception.
Instance Method Summary collapse
-
#inspect ⇒ String
The human-readable description for the exception.
-
#message ⇒ String
The human-readable exception message.
-
#new(policy) ⇒ Policy::ViolationError
Constructs an exception.
Instance Attribute Details
#messages ⇒ Array<String> (readonly)
The list of messages from the broken policy
19 20 21 |
# File 'lib/policy/violation_error.rb', line 19 def @messages end |
#policy ⇒ Policy::Follower (readonly)
The violated policy object
13 14 15 |
# File 'lib/policy/violation_error.rb', line 13 def policy @policy end |
Class Method Details
.initialize(policy) ⇒ Policy::ViolationError
Constructs an exception
29 30 31 32 |
# File 'lib/policy/violation_error.rb', line 29 def initialize(policy) @policy = policy.dup @messages = @policy. end |
Instance Method Details
#inspect ⇒ String
The human-readable description for the exception
37 38 39 |
# File 'lib/policy/violation_error.rb', line 37 def inspect "#<#{ self }: #{ }>" end |
#message ⇒ String
The human-readable exception message
44 45 46 |
# File 'lib/policy/violation_error.rb', line 44 def "#{ policy } violated: #{ }" end |
#new(policy) ⇒ Policy::ViolationError
Constructs an exception
29 30 31 32 |
# File 'lib/policy/violation_error.rb', line 29 def initialize(policy) @policy = policy.dup @messages = @policy. end |