Class: Dry::Validation::Error::Set
- Inherits:
-
Object
- Object
- Dry::Validation::Error::Set
- Includes:
- Enumerable
- Defined in:
- lib/dry/validation/error.rb
Instance Attribute Summary collapse
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
Instance Method Summary collapse
- #<<(error) ⇒ Object
- #each(&block) ⇒ Object
- #empty? ⇒ Boolean
-
#initialize ⇒ Set
constructor
A new instance of Set.
- #to_ary ⇒ Object (also: #to_a)
Constructor Details
#initialize ⇒ Set
Returns a new instance of Set.
9 10 11 |
# File 'lib/dry/validation/error.rb', line 9 def initialize @errors = [] end |
Instance Attribute Details
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
7 8 9 |
# File 'lib/dry/validation/error.rb', line 7 def errors @errors end |
Instance Method Details
#<<(error) ⇒ Object
21 22 23 |
# File 'lib/dry/validation/error.rb', line 21 def <<(error) errors << error end |
#each(&block) ⇒ Object
13 14 15 |
# File 'lib/dry/validation/error.rb', line 13 def each(&block) errors.each(&block) end |
#empty? ⇒ Boolean
17 18 19 |
# File 'lib/dry/validation/error.rb', line 17 def empty? errors.empty? end |
#to_ary ⇒ Object Also known as: to_a
25 26 27 |
# File 'lib/dry/validation/error.rb', line 25 def to_ary errors.map { |error| error.to_ary } end |