Class: Hash

Inherits:
Object
  • Object
show all
Includes:
ValidKeys
Defined in:
lib/active_resource_throttle/hash_ext.rb

Instance Method Summary collapse

Methods included from ValidKeys

#assert_valid_keys

Instance Method Details

#assert_required_keys(*required_keys) ⇒ Object

Raises:

  • (ArgumentError)


11
12
13
14
# File 'lib/active_resource_throttle/hash_ext.rb', line 11

def assert_required_keys(*required_keys)
  missing_keys = required_keys.select {|key| !keys.include?(key)}
  raise ArgumentError, "Missing required option(s): #{missing_keys.join(", ")}" unless missing_keys.empty?
end