Sha256: 0accc540ed372ae211aa580b905db9874c069ee300aeabd404c95509dcc07204

Contents?: true

Size: 421 Bytes

Versions: 11

Compression:

Stored size: 421 Bytes

Contents

# frozen_string_literal: true

module Kind
  require 'kind/monad'

  class Maybe::Monad::Wrapper < Kind::Monad::Wrapper
    def none(matcher = UNDEFINED)
      return if @monad.some? || output?

      @output = yield(@monad.value) if @monad.maybe?(matcher)
    end

    def some(matcher = UNDEFINED)
      return if @monad.none? || output?

      @output = yield(@monad.value) if @monad.maybe?(matcher)
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
kind-5.10.0 lib/kind/maybe/monad/wrapper.rb
kind-5.9.0 lib/kind/maybe/monad/wrapper.rb
kind-5.8.1 lib/kind/maybe/monad/wrapper.rb
kind-5.8.0 lib/kind/maybe/monad/wrapper.rb
kind-5.7.0 lib/kind/maybe/monad/wrapper.rb
kind-5.6.0 lib/kind/maybe/monad/wrapper.rb
kind-5.5.0 lib/kind/maybe/monad/wrapper.rb
kind-5.4.1 lib/kind/maybe/monad/wrapper.rb
kind-5.4.0 lib/kind/maybe/monad/wrapper.rb
kind-5.3.0 lib/kind/maybe/monad/wrapper.rb
kind-5.2.0 lib/kind/maybe/monad/wrapper.rb