Class: Either::Right
Instance Method Summary collapse
- #flat_map {|val| ... } ⇒ Object
-
#initialize(val) ⇒ Right
constructor
A new instance of Right.
- #left? ⇒ Boolean
- #map ⇒ Object
- #right? ⇒ Boolean
Methods included from Shared
Constructor Details
#initialize(val) ⇒ Right
Returns a new instance of Right.
61 62 63 |
# File 'lib/either.rb', line 61 def initialize(val) @val = val end |
Instance Method Details
#flat_map {|val| ... } ⇒ Object
69 70 71 |
# File 'lib/either.rb', line 69 def flat_map yield val end |
#left? ⇒ Boolean
54 55 56 |
# File 'lib/either.rb', line 54 def left? false end |
#map ⇒ Object
65 66 67 |
# File 'lib/either.rb', line 65 def map Either.new { yield val } end |
#right? ⇒ Boolean
57 58 59 |
# File 'lib/either.rb', line 57 def right? true end |