lib/option.rb in option-0.5.0 vs lib/option.rb in option-0.6.0
- old
+ new
@@ -82,10 +82,17 @@
end
def or_else(&blk)
self
end
+
+ def flatten
+ case get
+ when OptionClass then get.flatten
+ else self
+ end
+ end
end
class NoneClass < OptionClass
def to_a
@@ -140,9 +147,13 @@
self
end
def or_else(&blk)
assert_option(blk.call)
+ end
+
+ def flatten
+ self
end
end
None = NoneClass.new
Some = SomeClass