Class: Dry::Validation::Error::Set

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/dry/validation/error.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(errors) ⇒ Set

Returns a new instance of Set.



9
10
11
# File 'lib/dry/validation/error.rb', line 9

def initialize(errors)
  @errors = errors
end

Instance Attribute Details

#errorsObject (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

#each(&block) ⇒ Object



13
14
15
# File 'lib/dry/validation/error.rb', line 13

def each(&block)
  errors.each(&block)
end

#empty?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/dry/validation/error.rb', line 17

def empty?
  errors.empty?
end

#to_aryObject Also known as: to_a



21
22
23
# File 'lib/dry/validation/error.rb', line 21

def to_ary
  errors.map { |error| error.to_ary }
end