lib/option.rb in option-1.1.0 vs lib/option.rb in option-1.2.0
- old
+ new
@@ -8,11 +8,10 @@
when OptionClass then or_nil == that.or_nil
else or_nil == that
end
end
-
private
def assert_option(result)
case result
when OptionClass then return result
@@ -94,10 +93,14 @@
case get
when OptionClass then get.flatten
else self
end
end
+
+ def error(*argv)
+ self
+ end
end
class NoneClass < OptionClass
def dup
@@ -168,9 +171,13 @@
assert_option(blk.call)
end
def flatten
self
+ end
+
+ def error(*argv)
+ argv.empty? ? raise : raise(*argv)
end
end
None = NoneClass.new
Some = SomeClass