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