This is another wrong, incomplete implementation of Maybe data type in Ruby.
This gist is a full-blown gem. In order to use it, just add the following line to your Gemfile.
gem 'maybe', gist: 'da2aaafdfd71e6ff0ffd'
To my knowledge, all existing gems are too fat and do not provide the ability to configure what values should be treated as
Just and what values are
Nothing. Some treat
Nothing, some treat only
Nothing, some rely on truthiness (this is the most reasonable choice in my opinion). In my particular use case, I needed to treat
true. Obviously, hard-coding this Railsism into the gem is not an option, so I pass the Nothingness predicate into Maybe data constructor (pardon my French).