lib/totally_lazy/option.rb in totally_lazy-0.1.25 vs lib/totally_lazy/option.rb in totally_lazy-0.1.26

- old
+ new

@@ -26,10 +26,12 @@ Option.none end end class Option + include Comparable + def self.option(value) value.nil? ? none : some(value) end def self.some(value) @@ -53,11 +55,10 @@ flat_map(identity) end end class Some < Option - include Comparable include LambdaBlock attr_reader :value def initialize(value) @@ -198,9 +199,13 @@ alias get_or_throw get_or_raise def enumerator Enumerator.new { |y| raise StopIteration.new } + end + + def <=>(other) + other == NONE end def to_s 'None' end