Sha256: 78ef677952e6466be922c1cbb9502fc3e3a5409dfeb1ca4bf50548b891988092

Contents?: true

Size: 361 Bytes

Versions: 3

Compression:

Stored size: 361 Bytes

Contents

# frozen_string_literal: true

class BCDD::Result
  class Success < self
    def success?(type = nil)
      type.nil? || type == self.type
    end

    def failure?(_type = nil)
      false
    end

    def value_or
      value
    end

    alias data_or value_or
  end

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
bcdd-result-0.3.0 lib/bcdd/result/success.rb
bcdd-result-0.2.0 lib/bcdd/result/success.rb
bcdd-result-0.1.0 lib/bcdd/result/success.rb