class Monad::Maybe::Base

Attributes

value[R]

Public Instance Methods

<<(obj) click to toggle source
# File lib/monad/maybe/base.rb, line 6
def <<(obj)
  to_list << obj
end
and(&blk) click to toggle source
# File lib/monad/maybe/base.rb, line 31
def and(&blk)
  self.then(blk)
end
maybe(&blk) click to toggle source
# File lib/monad/maybe/base.rb, line 22
def maybe(&blk)
  bind(blk)
end
maybe?() click to toggle source
# File lib/monad/maybe/base.rb, line 10
def maybe?
  true
end
then(fn) click to toggle source
# File lib/monad/maybe/base.rb, line 26
def then(fn)
  bind(->(x){ fn && fn.call })
  self
end
to_list() click to toggle source
# File lib/monad/maybe/base.rb, line 14
def to_list
  List.new(to_a)
end
to_maybe() click to toggle source
# File lib/monad/maybe/base.rb, line 18
def to_maybe
  self
end