Sha256: 0fddcefdc282ae40c9e785c83d4d133446124c1a49f5ac3bd312ac47be572f0b
Contents?: true
Size: 1.29 KB
Versions: 3
Compression:
Stored size: 1.29 KB
Contents
# frozen_string_literal: true module Dry module Types # Result class used by {Type#try} # # @api public class Result include ::Dry::Equalizer(:input, immutable: true) # @return [Object] attr_reader :input # @param [Object] input # # @api private def initialize(input) @input = input end # Success result # # @api public class Success < Result # @return [true] # # @api public def success? = true # @return [false] # # @api public def failure? = false end # Failure result # # @api public class Failure < Result include ::Dry::Equalizer(:input, :error, immutable: true) # @return [#to_s] attr_reader :error # @param [Object] input # # @param [#to_s] error # # @api private def initialize(input, error) super(input) @error = error end # @return [String] # # @api private def to_s = error.to_s # @return [false] # # @api public def success? = false # @return [true] # # @api public def failure? = true end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
dry-types-1.8.2 | lib/dry/types/result.rb |
dry-types-1.8.1 | lib/dry/types/result.rb |
dry-types-1.8.0 | lib/dry/types/result.rb |