lib/optional/option.rb in optional-0.0.4 vs lib/optional/option.rb in optional-0.0.5
- old
+ new
@@ -1,7 +1,11 @@
module Option
include Option::Enumerable
+ def self.[] value
+ value.nil? ? None : Some[value]
+ end
+
def match(&block)
Match.new.tap { |m| block.call(m) }.evaluate(self)
end
protected