Module: MonadOxide

Defined in:
lib/monad-oxide.rb,
lib/ok.rb,
lib/err.rb,
lib/result.rb,
lib/version.rb

Overview

The top level module for the monad-oxide library. Of interest, @see ‘Result’,

See Also:

  • and @see `Ok'.

Defined Under Namespace

Classes: Err, MonadOxideError, Ok, Result, ResultMethodNotImplementedError, ResultReturnExpectedError, UnwrapError

Constant Summary collapse

VERSION =

This version is locked to 0.x.0 because semver is a lie and this project uses CICD to push new versions. Any commits that appear on main will result in a new version of the gem created and published.

'0.12.0'

Class Method Summary collapse

Class Method Details

.err(data) ⇒ Result<A, E=Exception>

Create an ‘Err’ as a conveniece method.

Parameters:

  • data (Exception)

    The ‘Exception’ for this ‘Err’.

Returns:

  • (Result<A, E=Exception>)

    the ‘Err’ from the provided ‘Exception’.



17
18
19
# File 'lib/monad-oxide.rb', line 17

def err(data)
  MonadOxide::Err.new(data)
end

.ok(data) ⇒ Result<A, E=Exception>

Create an ‘Ok’ as a conveniece method.

Parameters:

  • data (Object)

    The inner data for this ‘Ok’.

Returns:

  • (Result<A, E=Exception>)

    the ‘Ok’ from the provided inner data.



25
26
27
# File 'lib/monad-oxide.rb', line 25

def ok(data)
  MonadOxide::Ok.new(data)
end