Sha256: e90df99874630e847b6948cb36d2c4a830ff9f981d69c0093c18a7a1315dce9c

Contents?: true

Size: 642 Bytes

Versions: 6

Compression:

Stored size: 642 Bytes

Contents

module Dry
  module Validation
    class Error
      class Set
        include Enumerable

        attr_reader :errors

        def initialize(errors)
          @errors = errors
        end

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

        def empty?
          errors.empty?
        end

        def to_ary
          errors.map { |error| error.to_ary }
        end
        alias_method :to_a, :to_ary
      end

      attr_reader :result

      def initialize(result)
        @result = result
      end

      def to_ary
        [:error, result.to_ary]
      end
      alias_method :to_a, :to_ary
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
dry-validation-0.6.0 lib/dry/validation/error.rb
dry-validation-0.5.0 lib/dry/validation/error.rb
dry-validation-0.4.1 lib/dry/validation/error.rb
dry-validation-0.4.0 lib/dry/validation/error.rb
dry-validation-0.3.1 lib/dry/validation/error.rb
dry-validation-0.3.0 lib/dry/validation/error.rb