Sha256: ffd3a818ba36835098f7712bd8d91072e6b22d6bfd3d5061a481cc60f638491a

Contents?: true

Size: 383 Bytes

Versions: 1

Compression:

Stored size: 383 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

    private

    def name
      :success
    end
  end

  def self.Success(type, value = nil)
    Success.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/success.rb