Module: Fear::Option::Mixin
- Included in:
- Mixin
- Defined in:
- lib/fear/option.rb
Overview
Include this mixin to access convenient factory methods.
Constant Summary collapse
Instance Method Summary collapse
- #None ⇒ None
-
#Option(value) ⇒ Some, None
An
Optionfactory which createsSomeif the argument is notnil, andNoneif it isnil. - #Some(value) ⇒ None
Instance Method Details
#Option(value) ⇒ Some, None
An Option factory which creates Some if the argument is not nil, and None if it is nil.
210 211 212 213 214 215 216 |
# File 'lib/fear/option.rb', line 210 def Option(value) if value.nil? None else Some(value) end end |
#Some(value) ⇒ None
225 226 227 |
# File 'lib/fear/option.rb', line 225 def Some(value) Some.new(value) end |