module Fear::OptionApi
Public Instance Methods
none()
click to toggle source
@return [Fear::None] @example
Fear.none #=> #<Fear::None>
# File lib/fear/option_api.rb, line 26 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
Fear.option(nil) #=> #<Fear::None> Fear.option(17) #=> #<Fear::Some get=17>
# File lib/fear/option_api.rb, line 14 def option(value) if value.nil? none else some(value) end end
some(value)
click to toggle source
@param value [any] @return [Fear::Some] @example
Fear.some(17) #=> #<Fear::Some get=17> Fear.some(nil) #=> #<Fear::Some get=nil>
# File lib/fear/option_api.rb, line 36 def some(value) Fear::Some.new(value) end