module Fear::RightBiased::Interface

Performs necessary interface and type checks.

Public Instance Methods

flat_map() click to toggle source
Calls superclass method
# File lib/fear/right_biased.rb, line 25
def flat_map
  super.tap do |result|
    Utils.assert_type!(result, left_class, right_class)
  end
end
get_or_else(*args, &block) click to toggle source

Returns the value from this `RightBiased::Right` or the given argument if this is a `RightBiased::Left`.

Calls superclass method
# File lib/fear/right_biased.rb, line 11
def get_or_else(*args, &block)
  Utils.assert_arg_or_block!("get_or_else", *args, &block)
  super
end
or_else(*args, &block) click to toggle source

Returns this `RightBiased::Right` or the given alternative if this is a `RightBiased::Left`.

Calls superclass method
# File lib/fear/right_biased.rb, line 18
def or_else(*args, &block)
  Utils.assert_arg_or_block!("or_else", *args, &block)
  super.tap do |result|
    Utils.assert_type!(result, left_class, right_class)
  end
end
select(*) click to toggle source

Ensures that returned value either left, or right.

Calls superclass method
# File lib/fear/right_biased.rb, line 32
def select(*)
  super.tap do |result|
    Utils.assert_type!(result, left_class, right_class)
  end
end