Sha256: 056d7a7e7b1933b1202b791e6d933d07c0e0cce98445b7197481d6ff44a2bfb6

Contents?: true

Size: 382 Bytes

Versions: 1

Compression:

Stored size: 382 Bytes

Contents

module Option
  include Option::Enumerable

  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

1 entries across 1 versions & 1 rubygems

Version Path
optional-0.0.4 lib/optional/option.rb