Class: Rumonade::Right
Overview
The right side of the disjoint union, as opposed to the Left side.
Constant Summary
Constants inherited from Either
Instance Attribute Summary collapse
-
#right_value ⇒ Object
readonly
Returns the right value.
Instance Method Summary collapse
-
#==(other) ⇒ Boolean
Returns
true
if other is aRight
with an equal right value. -
#initialize(right_value) ⇒ Right
constructor
A new instance of Right.
-
#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(right_value) ⇒ Right
Returns a new instance of Right.
124 125 126 |
# File 'lib/rumonade/either.rb', line 124 def initialize(right_value) @right_value = right_value end |
Instance Attribute Details
#right_value ⇒ Object (readonly)
Returns the right value
129 130 131 |
# File 'lib/rumonade/either.rb', line 129 def right_value @right_value end |
Instance Method Details
#==(other) ⇒ Boolean
Returns true
if other is a Right
with an equal right value
132 133 134 |
# File 'lib/rumonade/either.rb', line 132 def ==(other) other.is_a?(Right) && other.right_value == self.right_value end |
#inspect ⇒ String
Returns a String
containing a human-readable representation of this object.
142 143 144 |
# File 'lib/rumonade/either.rb', line 142 def inspect "Right(#{right_value.inspect})" end |
#to_s ⇒ String
Returns a String
representation of this object.
137 138 139 |
# File 'lib/rumonade/either.rb', line 137 def to_s "Right(#{right_value})" end |