Module: Hive::Utilities::Hash

Included in:
Pool
Defined in:
lib/hive/utilities/hash.rb

Overview

Gives you assert_valid_keys without infecting Hash

Instance Method Summary collapse

Instance Method Details

#assert_valid_keys(hash, *valid_keys) ⇒ Object



9
10
11
12
13
# File 'lib/hive/utilities/hash.rb', line 9

def assert_valid_keys( hash, *valid_keys )
  hash.each_key do |key|
    raise(ArgumentError, "Unknown key: #{key}") unless valid_keys.include?(key)
  end
end