Module: Utils::Data Private

Defined in:
utils/data.rb

This module is part of a private API. This module may only be used in the Homebrew/brew repository. Third parties should avoid using this module if possible, as it may be removed or changed without warning.

Class Method Summary collapse

Class Method Details

.assert_valid_keys(hash, *valid_keys) ⇒ void

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

This method returns an undefined value.

Parameters:



9
10
11
12
13
14
15
16
17
18
# File 'utils/data.rb', line 9

def assert_valid_keys(hash, *valid_keys)
  valid_keys.flatten!
  hash.each_key do |key|
    next if valid_keys.include?(key)

    Kernel.raise ArgumentError,
                 "Unknown key: #{key.inspect}. " \
                 "Valid keys are: #{valid_keys.map(&:inspect).join(", ")}"
  end
end