Exception: RescueEach::Error
- Inherits:
-
StandardError
- Object
- StandardError
- RescueEach::Error
- Defined in:
- lib/rescue_each.rb
Defined Under Namespace
Classes: Item
Instance Attribute Summary collapse
-
#aborted ⇒ Object
readonly
Returns the value of attribute aborted.
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
Instance Method Summary collapse
-
#initialize(errors, aborted = false) ⇒ Error
constructor
A new instance of Error.
- #to_s ⇒ Object
Constructor Details
#initialize(errors, aborted = false) ⇒ Error
Returns a new instance of Error.
10 11 12 13 |
# File 'lib/rescue_each.rb', line 10 def initialize(errors, aborted=false) @errors = errors @aborted = aborted end |
Instance Attribute Details
#aborted ⇒ Object (readonly)
Returns the value of attribute aborted.
8 9 10 |
# File 'lib/rescue_each.rb', line 8 def aborted @aborted end |
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
8 9 10 |
# File 'lib/rescue_each.rb', line 8 def errors @errors end |
Instance Method Details
#to_s ⇒ Object
60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/rescue_each.rb', line 60 def to_s msg = [] errors.each_with_index do |error, idx| msg << "rescue_each catch ##{idx+1}: " msg << error.to_s msg << "\n" end msg << "rescue_each caught #{errors.size} errors" msg << ", and then aborted." if aborted msg.join end |