Sha256: d402ecdd0848338cd812b1e48b10bdaf1ece66db4ca3457481fe1d0300beff47

Contents?: true

Size: 383 Bytes

Versions: 1

Compression:

Stored size: 383 Bytes

Contents

# frozen_string_literal: true

class BCDD::Result
  class Failure < self
    def success?(_type = nil)
      false
    end

    def failure?(type = nil)
      type.nil? || type == self.type
    end

    def value_or
      yield
    end

    private

    def name
      :failure
    end
  end

  def self.Failure(type, value = nil)
    Failure.new(type: type, value: value)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bcdd-result-0.4.0 lib/bcdd/result/failure.rb