lib/totally_lazy/option.rb in totally_lazy-0.1.61 vs lib/totally_lazy/option.rb in totally_lazy-0.1.62
- old
+ new
@@ -118,10 +118,14 @@
get
end
alias get_or_throw get_or_raise
+ def to_either(left)
+ right(value)
+ end
+
def enumerator
Enumerator.new { |y|
y << @value
raise StopIteration.new
}
@@ -199,9 +203,13 @@
alias get_or_throw get_or_raise
def enumerator
Enumerator.new { |y|
raise StopIteration.new
}
+ end
+
+ def to_either(value)
+ left(value)
end
def <=>(other)
other == NONE
end