Exception: Protocol::CheckFailed
- Inherits:
-
ProtocolError
- Object
- StandardError
- ProtocolError
- Protocol::CheckFailed
- Includes:
- Enumerable, CheckError
- Defined in:
- lib/protocol/errors.rb
Overview
This exception collects CheckError exceptions and mixes in Enumerable for further processing of them.
Instance Attribute Summary collapse
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
Instance Method Summary collapse
-
#<<(check_error) ⇒ Object
Add
check_errorto this CheckFailed instance. -
#each_error(&block) ⇒ Object
(also: #each)
Iterate over all errors of this CheckFailed instance and pass each one to
block. -
#empty? ⇒ Boolean
Return true, if this CheckFailed doesn’t contain any errors (yet).
-
#initialize(*errors) ⇒ CheckFailed
constructor
A new instance of CheckFailed.
- #inspect ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(*errors) ⇒ CheckFailed
Returns a new instance of CheckFailed.
60 61 62 |
# File 'lib/protocol/errors.rb', line 60 def initialize(*errors) @errors = errors end |
Instance Attribute Details
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
64 65 66 |
# File 'lib/protocol/errors.rb', line 64 def errors @errors end |
Instance Method Details
#<<(check_error) ⇒ Object
Add check_error to this CheckFailed instance.
73 74 75 76 |
# File 'lib/protocol/errors.rb', line 73 def <<(check_error) @errors << check_error self end |
#each_error(&block) ⇒ Object Also known as: each
Iterate over all errors of this CheckFailed instance and pass each one to block.
80 81 82 |
# File 'lib/protocol/errors.rb', line 80 def each_error(&block) errors.each(&block) end |
#empty? ⇒ Boolean
Return true, if this CheckFailed doesn’t contain any errors (yet). Otherwise false is returned.
68 69 70 |
# File 'lib/protocol/errors.rb', line 68 def empty? errors.empty? end |
#inspect ⇒ Object
91 92 93 |
# File 'lib/protocol/errors.rb', line 91 def inspect "#<#{self.class.name}: #{errors.map { |e| e.inspect} * '|'}" end |
#to_s ⇒ Object
87 88 89 |
# File 'lib/protocol/errors.rb', line 87 def to_s errors * "|" end |