Class: Either::Right

Inherits:
Trither::Box show all
Includes:
Trither::BasicTypes
Defined in:
lib/trither/either.rb,
lib/trither/either.rb

Constant Summary

Constants included from Trither::BasicTypes

Trither::BasicTypes::C, Trither::BasicTypes::Func0, Trither::BasicTypes::Func1, Trither::BasicTypes::Predicate

Constants inherited from Trither::Box

Trither::Box::C

Instance Method Summary collapse

Methods inherited from Trither::Box

#==, #initialize

Constructor Details

This class inherits a constructor from Trither::Box

Instance Method Details

#left?Boolean

Returns:

  • (Boolean)


58
59
60
# File 'lib/trither/either.rb', line 58

def left?
  false
end

#left_flat_mapObject



83
84
85
# File 'lib/trither/either.rb', line 83

def left_flat_map
  self
end

#left_mapObject



73
74
75
# File 'lib/trither/either.rb', line 73

def left_map
  self
end

#rightObject



68
69
70
# File 'lib/trither/either.rb', line 68

def right
  @value
end

#right?Boolean

Returns:

  • (Boolean)


63
64
65
# File 'lib/trither/either.rb', line 63

def right?
  true
end

#right_flat_map {|@value| ... } ⇒ Object

Yields:

  • (@value)


88
89
90
# File 'lib/trither/either.rb', line 88

def right_flat_map
  yield @value
end

#right_mapObject



78
79
80
# File 'lib/trither/either.rb', line 78

def right_map
  Right.new(yield @value)
end