class Monad::Maybe::Just
Public Class Methods
new(value)
click to toggle source
# File lib/monad/maybe/just.rb, line 4 def initialize(value) @value = value end
Public Instance Methods
==(other)
click to toggle source
# File lib/monad/maybe/just.rb, line 36 def ==(other) self === other || self.value == other end
===(other)
click to toggle source
# File lib/monad/maybe/just.rb, line 40 def ===(other) other.just? && self.value == other.value end
bind(fn)
click to toggle source
# File lib/monad/maybe/just.rb, line 28 def bind(fn) fn[@value].to_maybe end
equal?(other)
click to toggle source
# File lib/monad/maybe/just.rb, line 44 def equal?(other) other.__id__ == self.__id__ end
inspect()
click to toggle source
# File lib/monad/maybe/just.rb, line 48 def inspect "just(#{value.inspect})" end
just?()
click to toggle source
# File lib/monad/maybe/just.rb, line 24 def just? true end
method_missing(method, *args)
click to toggle source
# File lib/monad/maybe/just.rb, line 8 def method_missing(method, *args) value.send(method, *args).to_maybe end
nil?()
click to toggle source
# File lib/monad/maybe/just.rb, line 32 def nil? false end
nothing?()
click to toggle source
# File lib/monad/maybe/just.rb, line 16 def nothing? false end
something?()
click to toggle source
# File lib/monad/maybe/just.rb, line 20 def something? true end
to_a()
click to toggle source
# File lib/monad/maybe/just.rb, line 57 def to_a [self] end
to_json(*args)
click to toggle source
# File lib/monad/maybe/json.rb, line 9 def to_json(*args) value.to_json(*args) end
to_s()
click to toggle source
# File lib/monad/maybe/just.rb, line 52 def to_s value.to_s end
Also aliased as: to_str
unwrap(val=nil, &blk)
click to toggle source
# File lib/monad/maybe/just.rb, line 12 def unwrap(val=nil, &blk) value end