Sha256: f468edfe97bfdaa7a84562ae7e939c9488630ccd62a61959b9d9bdaf75f2a886

Contents?: true

Size: 440 Bytes

Versions: 3

Compression:

Stored size: 440 Bytes

Contents

# frozen_string_literal: true

class BCDD::Result::Context::Success < BCDD::Result::Context
  include ::BCDD::Result::Success::Methods

  def and_expose(type, keys)
    unless keys.is_a?(::Array) && !keys.empty? && keys.all?(::Symbol)
      raise ::ArgumentError, 'keys must be an Array of Symbols'
    end

    exposed_value = acc.merge(value).slice(*keys)

    self.class.new(type: type, value: exposed_value, subject: subject)
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
bcdd-result-0.9.0 lib/bcdd/result/context/success.rb
bcdd-result-0.8.0 lib/bcdd/result/context/success.rb
bcdd-result-0.7.0 lib/bcdd/result/context/success.rb