Class: Hash

Inherits:
Object
  • Object
show all
Defined in:
lib/liquidplanner/ext/hash.rb

Instance Method Summary collapse

Instance Method Details

#assert_required_keys(*required_keys) ⇒ Object

Raises:

  • (ArgumentError)


2
3
4
5
# File 'lib/liquidplanner/ext/hash.rb', line 2

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