Module: Fear::OptionApi
- Included in:
- Fear
- Defined in:
- lib/fear/option_api.rb
Instance Method Summary collapse
- #none ⇒ Fear::None
-
#option(value) ⇒ Fear::Option<any>
An
Option
factory which createsSome
if the argument is notnil
, andNone
if it isnil
. - #some(value) ⇒ Fear::Some
Instance Method Details
#option(value) ⇒ Fear::Option<any>
An Option
factory which creates Some
if the argument is not nil
, and None
if it is nil
.
14 15 16 17 18 19 20 |
# File 'lib/fear/option_api.rb', line 14 def option(value) if value.nil? none else some(value) end end |
#some(value) ⇒ Fear::Some
36 37 38 |
# File 'lib/fear/option_api.rb', line 36 def some(value) Fear::Some.new(value) end |