Class: Rumonade::Left
Overview
The left side of the disjoint union, as opposed to the Right side.
Constant Summary
Constants inherited from Either
Instance Attribute Summary collapse
-
#left_value ⇒ Object
readonly
Returns the left value.
Instance Method Summary collapse
-
#==(other) ⇒ Boolean
Returns
true
if other is aLeft
with an equal left value. -
#initialize(left_value) ⇒ Left
constructor
A new instance of Left.
-
#inspect ⇒ String
Returns a
String
containing a human-readable representation of this object. -
#to_s ⇒ String
Returns a
String
representation of this object.
Methods inherited from Either
#+, #fold, #left, #left?, #lift, #lift_to_a, #right, #right?, #swap
Constructor Details
#initialize(left_value) ⇒ Left
Returns a new instance of Left.
98 99 100 |
# File 'lib/rumonade/either.rb', line 98 def initialize(left_value) @left_value = left_value end |
Instance Attribute Details
#left_value ⇒ Object (readonly)
Returns the left value
103 104 105 |
# File 'lib/rumonade/either.rb', line 103 def left_value @left_value end |
Instance Method Details
#==(other) ⇒ Boolean
Returns true
if other is a Left
with an equal left value
106 107 108 |
# File 'lib/rumonade/either.rb', line 106 def ==(other) other.is_a?(Left) && other.left_value == self.left_value end |
#inspect ⇒ String
Returns a String
containing a human-readable representation of this object.
116 117 118 |
# File 'lib/rumonade/either.rb', line 116 def inspect "Left(#{left_value.inspect})" end |
#to_s ⇒ String
Returns a String
representation of this object.
111 112 113 |
# File 'lib/rumonade/either.rb', line 111 def to_s "Left(#{left_value})" end |