module Fear::RightBiased::Right

Public Class Methods

included(base) click to toggle source
# File lib/fear/right_biased.rb, line 41
def included(base)
  base.prepend Interface
end

Public Instance Methods

===(other) click to toggle source

Used in case statement @param other [any] @return [Boolean]

Calls superclass method
# File lib/fear/right_biased.rb, line 103
def ===(other)
  if other.is_a?(right_class)
    value === other.value
  else
    super
  end
end
any?() { |value| ... } click to toggle source

@return [Boolean] true if value satisfies predicate.

# File lib/fear/right_biased.rb, line 96
def any?
  yield(value)
end
each() { |value| ... } click to toggle source

@return [self]

# File lib/fear/right_biased.rb, line 69
def each
  yield(value)
  self
end
flat_map() { |value| ... } click to toggle source

Binds the given function across `RightBiased::Right`.

@return [RightBiased::Left, RightBiased::Right]

# File lib/fear/right_biased.rb, line 86
def flat_map
  yield(value)
end
get_or_else(*_args) click to toggle source

@overload get_or_else(default)

@param default [any]
@return [any] the `#value`.

@overload get_or_else(&default)

@return [any] the `#value`.
# File lib/fear/right_biased.rb, line 53
def get_or_else(*_args)
  value
end
include?(other_value) click to toggle source

@param [any] @return [Boolean]

# File lib/fear/right_biased.rb, line 64
def include?(other_value)
  value == other_value
end
map() { |value| ... } click to toggle source

Maps the value using given block.

@return [RightBiased::Right]

# File lib/fear/right_biased.rb, line 78
def map
  self.class.new(yield(value))
end
or_else() click to toggle source

@return [self]

# File lib/fear/right_biased.rb, line 58
def or_else
  self
end
to_option() click to toggle source

@return [Option] containing value

# File lib/fear/right_biased.rb, line 91
def to_option
  Some.new(value)
end