Class: Typed::Result

Inherits:
Object
  • Object
show all
Extended by:
T::Generic, T::Helpers, T::Sig
Defined in:
lib/typed/result.rb

Overview

A monad representing either a success or a failure. Contains payload and error information as well.

Direct Known Subclasses

Failure, Success

Constant Summary collapse

Payload =
type_member(:out)
Error =
type_member(:out)

Instance Method Summary collapse

Instance Method Details

#and_then(&_block) ⇒ Object



44
45
# File 'lib/typed/result.rb', line 44

def and_then(&_block)
end

#errorObject



35
36
# File 'lib/typed/result.rb', line 35

def error
end

#failure?Boolean

Returns:

  • (Boolean)


27
28
# File 'lib/typed/result.rb', line 27

def failure?
end

#on_error(&block) ⇒ Object



52
53
# File 'lib/typed/result.rb', line 52

def on_error(&block)
end

#payloadObject



31
32
# File 'lib/typed/result.rb', line 31

def payload
end

#payload_or(value) ⇒ Object



61
62
# File 'lib/typed/result.rb', line 61

def payload_or(value)
end

#success?Boolean

Returns:

  • (Boolean)


23
24
# File 'lib/typed/result.rb', line 23

def success?
end