module Fear::Option::Mixin
Include this mixin to access convenient factory methods. @example
include Fear::Option::Mixin Option(17) #=> #<Fear::Some get=17> Option(nil) #=> #<Fear::None> Some(17) #=> #<Fear::Some get=17> None() #=> #<Fear::None>
Public Instance Methods
None()
click to toggle source
@return [None] @example
None() #=> #<Fear::None>
# File lib/fear/option.rb, line 245 def None Fear.none end
Option(value)
click to toggle source
An Option
factory which creates Some
if the argument is not nil
, and None
if it is nil
. @param value [any] @return [Fear::Some, Fear::None]
@example
Option(17) #=> #<Fear::Some get=17> Option(nil) #=> #<Fear::None>
# File lib/fear/option.rb, line 237 def Option(value) Fear.option(value) end
Some(value)
click to toggle source
@param value [any] except nil @return [Fear::Some] @example
Some(17) #=> #<Fear::Some get=17> Some(nil) #=> #<Fear::Some get=nil>
# File lib/fear/option.rb, line 255 def Some(value) Fear.some(value) end