Module: Sheetah::Utils::MonadicResult

Included in:
Headers, RowValueBuilder, SheetProcessor, Types::CastChain
Defined in:
lib/sheetah/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

#Do(&block) ⇒ Object



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

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

#FailureObject



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

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

#SuccessObject

rubocop:disable Naming/MethodName



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

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