Class: Harbor::Errors
- Inherits:
-
Object
- Object
- Harbor::Errors
- Includes:
- Enumerable
- Defined in:
- lib/harbor/errors.rb
Instance Method Summary collapse
- #+(other) ⇒ Object
- #<<(message) ⇒ Object
- #[](index) ⇒ Object
- #each ⇒ Object
-
#initialize(errors = []) ⇒ Errors
constructor
A new instance of Errors.
- #size ⇒ Object
Constructor Details
#initialize(errors = []) ⇒ Errors
Returns a new instance of Errors.
7 8 9 |
# File 'lib/harbor/errors.rb', line 7 def initialize(errors = []) @errors = errors end |
Instance Method Details
#+(other) ⇒ Object
37 38 39 |
# File 'lib/harbor/errors.rb', line 37 def +(other) Errors.new((errors + other.errors).uniq) end |
#<<(message) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/harbor/errors.rb', line 15 def <<() if .is_a?(String) errors << elsif .is_a?(Enumerable) .each do || errors << end else errors << end end |
#[](index) ⇒ Object
11 12 13 |
# File 'lib/harbor/errors.rb', line 11 def [](index) errors[index] end |
#each ⇒ Object
27 28 29 30 31 |
# File 'lib/harbor/errors.rb', line 27 def each errors.each do |error| yield error end end |
#size ⇒ Object
33 34 35 |
# File 'lib/harbor/errors.rb', line 33 def size errors.size end |