Sha256: 8e92cea84d16fe828ee9d5ac147e9625cee3f1afd37589f22204e06d65747fe9

Contents?: true

Size: 292 Bytes

Versions: 11

Compression:

Stored size: 292 Bytes

Contents

require 'dry/monads/either'

module Dry
  module Validation
    class Result
      include Dry::Monads::Either::Mixin

      def to_either(options = EMPTY_HASH)
        if success?
          Right(output)
        else
          Left(messages(options))
        end
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
dry-validation-0.11.2 lib/dry/validation/extensions/monads.rb
dry-validation-0.11.1 lib/dry/validation/extensions/monads.rb
dry-validation-0.11.0 lib/dry/validation/extensions/monads.rb
dry-validation-0.10.7 lib/dry/validation/extensions/monads.rb
dry-validation-0.10.6 lib/dry/validation/extensions/monads.rb
dry-validation-0.10.5 lib/dry/validation/extensions/monads.rb
dry-validation-0.10.4 lib/dry/validation/extensions/monads.rb
dry-validation-0.10.3 lib/dry/validation/extensions/monads.rb
dry-validation-0.10.2 lib/dry/validation/extensions/monads.rb
dry-validation-0.10.1 lib/dry/validation/extensions/monads.rb
dry-validation-0.10.0 lib/dry/validation/extensions/monads.rb