Sha256: bd2feac42e7b67839b10293dc689ac827db47f054c5496231d85d9abbd57e1e5

Contents?: true

Size: 799 Bytes

Versions: 1

Compression:

Stored size: 799 Bytes

Contents

# frozen_string_literal: true

class BCDD::Result::Context
  module Expectations::Mixin
    Factory = BCDD::Result::Expectations::Mixin::Factory

    Methods = BCDD::Result::Expectations::Mixin::Methods

    module Addons
      module Continue
        private def Continue(**value)
          Success.new(type: :continued, value: value, source: self)
        end
      end

      module Given
        private def Given(*values)
          value = values.map(&:to_h).reduce({}) { |acc, val| acc.merge(val) }

          Success.new(type: :given, value: value, source: self)
        end
      end

      OPTIONS = { continue: Continue, given: Given }.freeze

      def self.options(config_flags)
        ::BCDD::Result::Config::Options.addon(map: config_flags, from: OPTIONS)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bcdd-result-0.12.0 lib/bcdd/result/context/expectations/mixin.rb