Class: Dry::Types::Result::Failure

Inherits:
Dry::Types::Result show all
Defined in:
lib/dry/types/result.rb

Overview

Failure result

Instance Attribute Summary collapse

Attributes inherited from Dry::Types::Result

#input

Instance Method Summary collapse

Methods inherited from Dry::Types::Result

#to_monad

Constructor Details

#initialize(input, error) ⇒ Failure

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Failure.

Parameters:

  • input (Object)
  • error (#to_s)


50
51
52
53
# File 'lib/dry/types/result.rb', line 50

def initialize(input, error)
  super(input)
  @error = error
end

Instance Attribute Details

#error#to_s (readonly)

Returns:



43
44
45
# File 'lib/dry/types/result.rb', line 43

def error
  @error
end

Instance Method Details

#failure?true

Returns:

  • (true)


68
# File 'lib/dry/types/result.rb', line 68

def failure? = true

#success?false

Returns:

  • (false)


63
# File 'lib/dry/types/result.rb', line 63

def success? = false

#to_sString

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (String)


58
# File 'lib/dry/types/result.rb', line 58

def to_s = error.to_s