Module: Fear::Option::Mixin
- Included in:
- Mixin
- Defined in:
- lib/fear/option.rb
Overview
Include this mixin to access convenient factory methods.
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.
168 169 170 171 172 173 174 |
# File 'lib/fear/option.rb', line 168 def Option(value) if value.nil? None() else Some(value) end end |
#Some(value) ⇒ None
183 184 185 |
# File 'lib/fear/option.rb', line 183 def Some(value) Some.new(value) end |