Sha256: b8a50763548f011b18197ab4414a43c89c2f2ccbf6b6f15010ccf580cf975880

Contents?: true

Size: 431 Bytes

Versions: 6

Compression:

Stored size: 431 Bytes

Contents

module Dry
  module Validation
    class Error
      include Dry::Equalizer(:name, :result)

      attr_reader :name, :result

      def initialize(name, result)
        @name = name
        @result = result
      end

      def schema?
        result.response.is_a?(Validation::Result)
      end

      def to_ast
        node = [:error, [name, result.to_ast]]
        schema? ? [:schema, node] : node
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
dry-validation-0.8.0 lib/dry/validation/error.rb
dry-validation-0.7.4 lib/dry/validation/error.rb
dry-validation-0.7.3 lib/dry/validation/error.rb
dry-validation-0.7.2 lib/dry/validation/error.rb
dry-validation-0.7.1 lib/dry/validation/error.rb
dry-validation-0.7.0 lib/dry/validation/error.rb