ruby-possibly
ruby-possibly copied to clipboard
A maybe monad
# Release 0.3.0 ## Breaking changes - `or_else` is renamed to `get_or_else`. This change unifies the API naming. All the methods that start with `get_` return the unwrapped value. **Migration:**...
## or_else `or_else` returns the current `Maybe` if it's a `Some`, but if it's a `None`, it returns the parameter that was given to it (which should be a `Maybe`)....
## `combine([maybes])` With `combine` you can create a new `Maybe` which includes an array of values from combined `Maybe`s. If any of the combined `Maybe`s is a `None`, a `None`...
This is an opt-in implementation for laziness. By default Maybes are not lazy, but if you call `lazy` or initialize Maybe with a block, it becomes lazy. From README: ##...
Maybe implements the threequals method in a way which allows it to be used in case expressions pretty neatly: You can match both the type (`None` or `Some`) and the...