Sha256: 845f94d2c28cc47cd456efda6f254a812a0437678c191e85b1e39f721a49048f

Contents?: true

Size: 470 Bytes

Versions: 2

Compression:

Stored size: 470 Bytes

Contents

# frozen_string_literal: true

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

  def and_expose(type, keys, halted: true)
    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, halted: halted)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
bcdd-result-0.10.0 lib/bcdd/result/context/success.rb
bcdd-result-0.9.1 lib/bcdd/result/context/success.rb