Sha256: 7e656296eb100f6e45b5994607fbb78c5a3d23e185998f56ba0f49fea6bec4a1

Contents?: true

Size: 401 Bytes

Versions: 2

Compression:

Stored size: 401 Bytes

Contents

# frozen_string_literal: true

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

    def failure?(_type = nil)
      false
    end

    def value_or
      value
    end

    private

    def name
      :success
    end
  end

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
bcdd-result-0.6.0 lib/bcdd/result/success.rb
bcdd-result-0.5.0 lib/bcdd/result/success.rb