Module: MonadOxide
- Defined in:
- lib/error.rb,
lib/ok.rb,
lib/err.rb,
lib/left.rb,
lib/none.rb,
lib/some.rb,
lib/right.rb,
lib/either.rb,
lib/option.rb,
lib/result.rb,
lib/version.rb,
lib/monad-oxide.rb
Overview
The top level module for the monad-oxide library. Of interest, @see ‘Result’,
Defined Under Namespace
Classes: Either, EitherMethodNotImplementedError, EitherReturnExpectedError, Err, Left, MonadOxideError, None, Ok, Option, OptionMethodNotImplementedError, OptionReturnExpectedError, Result, ResultMethodNotImplementedError, ResultReturnExpectedError, Right, Some, 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.16.0'
Class Method Summary collapse
-
.err(data) ⇒ Result<A, E=Exception>
Create an ‘Err’ as a conveniece method.
- .left(data) ⇒ Object
- .none ⇒ Object
-
.ok(data) ⇒ Result<A, E=Exception>
Create an ‘Ok’ as a conveniece method.
- .option(data) ⇒ Object
- .right(data) ⇒ Object
- .some(data) ⇒ Object
Class Method Details
.err(data) ⇒ Result<A, E=Exception>
Create an ‘Err’ as a conveniece method.
24 25 26 |
# File 'lib/monad-oxide.rb', line 24 def err(data) MonadOxide::Err.new(data) end |
.left(data) ⇒ Object
28 29 30 |
# File 'lib/monad-oxide.rb', line 28 def left(data) MonadOxide::Left.new(data) end |
.none ⇒ Object
32 33 34 |
# File 'lib/monad-oxide.rb', line 32 def none() MonadOxide::None.new() end |
.ok(data) ⇒ Result<A, E=Exception>
Create an ‘Ok’ as a conveniece method.
40 41 42 |
# File 'lib/monad-oxide.rb', line 40 def ok(data) MonadOxide::Ok.new(data) end |
.option(data) ⇒ Object
44 45 46 |
# File 'lib/monad-oxide.rb', line 44 def option(data) data.nil?() ? none() : some(data) end |
.right(data) ⇒ Object
48 49 50 |
# File 'lib/monad-oxide.rb', line 48 def right(data) MonadOxide::Right.new(data) end |
.some(data) ⇒ Object
52 53 54 |
# File 'lib/monad-oxide.rb', line 52 def some(data) MonadOxide::Some.new(data) end |