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
>=(fn = nil, &block)
Alias for: bind
>>(value)
Alias for: apply
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: >=
inspect()
Alias for: to_s
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
to_s() click to toggle source

Just string representation.

# File lib/ribimaybe.rb, line 72
def to_s
  "Just(#{@value.inspect})"
end
Also aliased as: inspect