Class: Dry::Validation::BuildErrors

Inherits:
Object
  • Object
show all
Defined in:
lib/dry/validation/executor.rb

Direct Known Subclasses

Flat, Nested

Defined Under Namespace

Classes: Flat, Nested

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#pathObject (readonly)

Returns the value of attribute path.



55
56
57
# File 'lib/dry/validation/executor.rb', line 55

def path
  @path
end

Class Method Details

.[](path) ⇒ Object



57
58
59
# File 'lib/dry/validation/executor.rb', line 57

def self.[](path)
  path.nil? || path.empty? ? Flat.new : Nested.new(path)
end

Instance Method Details

#call(result) ⇒ Object



77
78
79
80
81
# File 'lib/dry/validation/executor.rb', line 77

def call(result)
  result
    .select { |_, r| r.failure? }
    .map { |name, r| Error.new(error_path(name), r) }
end