Module: Hash::ValidKeys

Included in:
Hash
Defined in:
lib/active_resource_throttle/hash_ext.rb

Instance Method Summary collapse

Instance Method Details

#assert_valid_keys(*valid_keys) ⇒ Object

Raises:

  • (ArgumentError)


2
3
4
5
# File 'lib/active_resource_throttle/hash_ext.rb', line 2

def assert_valid_keys(*valid_keys)
  unknown_keys = keys - valid_keys
  raise ArgumentError, "Invalid option(s): #{unknown_keys.join(", ")}" unless unknown_keys.empty?
end