Class: Right
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(value) ⇒ Right
constructor
A new instance of Right.
- #left ⇒ Object
- #left? ⇒ Boolean
- #right ⇒ Object
- #right? ⇒ Boolean
Methods included from Either
Constructor Details
#initialize(value) ⇒ Right
Returns a new instance of Right.
8 9 10 |
# File 'lib/right.rb', line 8 def initialize(value) @value = value end |
Class Method Details
.[](value) ⇒ Object
4 5 6 |
# File 'lib/right.rb', line 4 def self.[] value new value end |
Instance Method Details
#left ⇒ Object
12 13 14 |
# File 'lib/right.rb', line 12 def left None end |
#left? ⇒ Boolean
20 21 22 |
# File 'lib/right.rb', line 20 def left? false end |
#right ⇒ Object
16 17 18 |
# File 'lib/right.rb', line 16 def right Some[value] end |
#right? ⇒ Boolean
24 25 26 |
# File 'lib/right.rb', line 24 def right? true end |