class Ribimaybe::Maybe::Just
Public Class Methods
new(value)
click to toggle source
# File lib/ribimaybe.rb, line 67 def initialize(value) @value = value end
Public Instance Methods
==(other)
click to toggle source
# File lib/ribimaybe.rb, line 90 def ==(other) other.maybe(false) do |value| @value == value end end
apply(value)
click to toggle source
# File lib/ribimaybe.rb, line 141 def apply(value) value.map { |v| @value.curry.(v) } end
Also aliased as: >>
bind(fn = nil, &block)
click to toggle source
# File lib/ribimaybe.rb, line 159 def bind(fn = nil, &block) (fn || block).curry.(@value) end
Also aliased as: >=
map(&fn)
click to toggle source
# File lib/ribimaybe.rb, line 124 def map(&fn) Just.new(fn.curry.(@value)) end
maybe(_, &fn)
click to toggle source
# File lib/ribimaybe.rb, line 109 def maybe(_, &fn) fn.curry.(@value) end