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

Instance Method Summary collapse

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)


54
55
56
57
# File 'lib/dry/types/result.rb', line 54

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

Instance Attribute Details

#error#to_s (readonly)

Returns:



47
48
49
# File 'lib/dry/types/result.rb', line 47

def error
  @error
end

Instance Method Details

#failure?true

Returns:

  • (true)


76
77
78
# File 'lib/dry/types/result.rb', line 76

def failure?
  true
end

#success?false

Returns:

  • (false)


69
70
71
# File 'lib/dry/types/result.rb', line 69

def success?
  false
end

#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)


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

def to_s
  error.to_s
end