Module: Rumonade
- Defined in:
- lib/rumonade.rb,
lib/rumonade/hash.rb,
lib/rumonade/array.rb,
lib/rumonade/monad.rb,
lib/rumonade/either.rb,
lib/rumonade/errors.rb,
lib/rumonade/option.rb,
lib/rumonade/version.rb,
lib/rumonade/error_handling.rb
Overview
:nodoc:
Defined Under Namespace
Modules: ArrayExtensions, ErrorHandling, HashExtensions, Monad Classes: Either, Left, NoSuchElementError, NoneClass, Option, PartialFunction, Right, Some
Constant Summary collapse
- None =
The single global instance of NoneClass, representing the empty Option
NoneClass.instance
- VERSION =
"0.4.4"
Class Method Summary collapse
- .Left(left_value) ⇒ Left
-
.Option(value) ⇒ Object
Returns an Option wrapping the given value: Some if non-nil, None if nil.
- .Right(right_value) ⇒ Right
-
.Some(value) ⇒ Some
Returns a
Some
wrapping the given value, for convenience.
Instance Method Summary collapse
- #Left(left_value) ⇒ Left
-
#Option(value) ⇒ Object
Returns an Option wrapping the given value: Some if non-nil, None if nil.
- #Right(right_value) ⇒ Right
-
#Some(value) ⇒ Some
Returns a
Some
wrapping the given value, for convenience.
Class Method Details
.Left(left_value) ⇒ Left
149 150 151 |
# File 'lib/rumonade/either.rb', line 149 def Left(left_value) Left.new(left_value) end |
.Option(value) ⇒ Object
Returns an Option wrapping the given value: Some if non-nil, None if nil
127 128 129 |
# File 'lib/rumonade/option.rb', line 127 def Option(value) value.nil? ? None : Some(value) end |
Instance Method Details
#Left(left_value) ⇒ Left
149 150 151 |
# File 'lib/rumonade/either.rb', line 149 def Left(left_value) Left.new(left_value) end |
#Option(value) ⇒ Object
Returns an Option wrapping the given value: Some if non-nil, None if nil
127 128 129 |
# File 'lib/rumonade/option.rb', line 127 def Option(value) value.nil? ? None : Some(value) end |