Module: Tabulard::Utils::MonadicResult

Included in:
Headers, RowValueBuilder, TableProcessor, Types::CastChain
Defined in:
lib/tabulard/utils/monadic_result.rb

Defined Under Namespace

Modules: Result Classes: Failure, Success

Constant Summary collapse

Unit =

Unit is a singleton, and is used when there is no other meaningful value that could be returned.

It allows the Result implementation to distinguish between a null value (i.e. nil) and the lack of a value, to provide adequate behavior in each case.

The Result API should not expose Unit directly to its consumers.

Object.new

Instance Method Summary collapse

Instance Method Details

#DoObject



167
168
169
# File 'lib/tabulard/utils/monadic_result.rb', line 167

def Do(&)
  catch(DO_TOKEN, &)
end

#FailureObject



163
164
165
# File 'lib/tabulard/utils/monadic_result.rb', line 163

def Failure(...)
  Failure.new(...)
end

#SuccessObject

rubocop:disable Naming/MethodName



159
160
161
# File 'lib/tabulard/utils/monadic_result.rb', line 159

def Success(...)
  Success.new(...)
end