Module: Divergent
- Defined in:
- lib/divergent.rb,
lib/divergent/try.rb,
lib/divergent/try.rb,
lib/divergent/maybe.rb,
lib/divergent/maybe.rb,
lib/divergent/monad.rb,
lib/divergent/errors.rb,
lib/divergent/version.rb
Overview
Divergent is a collection of monad class to do error handling in Ruby.
Currently, it only contains two class:
-
Try: a container which can wraps possible errors.
-
Maybe: a container which wraps nil case.
Defined Under Namespace
Modules: Monad, Try Classes: Failure, Maybe, NoSuchElementError, Some, Success, UnSupportedOperationError
Constant Summary collapse
- None =
:nodoc: all
Class.new(Maybe) do # :nodoc: all include Singleton def empty? true end def get raise NoSuchElementError, 'no such element in None.get' end def to_s "None" end alias inspect to_s end.instance.freeze
- VERSION =
"0.4.0"
Class Method Summary collapse
- .Maybe(v) ⇒ Object
-
.Try ⇒ Object
Constructs a ‘Try` by calling the passed block.