Sha256: 999e7017b9deeceb7a378ab36bc1329d02308ea9ed145a747b16bdf4ec3e6c4d

Contents?: true

Size: 723 Bytes

Versions: 1

Compression:

Stored size: 723 Bytes

Contents

# frozen_string_literal: true

class BCDD::Result::Expectations
  module Mixin
    METHODS = <<~RUBY
      def Success(...)
        __expected::Success(...)
      end

      def Failure(...)
        __expected::Failure(...)
      end

      private

      def __expected
        @__expected ||= Expected.with(subject: self)
      end
    RUBY

    module Addons
      module Continuable
        private def Continue(value)
          ::BCDD::Result::Success.new(type: :continued, value: value, subject: self)
        end
      end

      OPTIONS = { Continue: Continuable }.freeze

      def self.options(names)
        Array(names).filter_map { |name| OPTIONS[name] }
      end
    end
  end

  private_constant :Mixin
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bcdd-result-0.6.0 lib/bcdd/result/expectations/mixin.rb