Sha256: 40eeffe95e330905bd17e68d5a1d2906f3d7abf575bee16b90224b0ab49d8ad4
Contents?: true
Size: 445 Bytes
Versions: 3
Compression:
Stored size: 445 Bytes
Contents
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 def and_option(option) none? ? self : Some[*[option.value, value].flatten] end private def from_array(values) values.empty? ? None : Some[*values] end def from_value(value) value.nil? ? None : Some[value] end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
optional-0.0.7 | lib/optional/option.rb |
optional-0.0.6 | lib/optional/option.rb |
optional-0.0.5 | lib/optional/option.rb |