Module: ForemanMaintain::CoreExt::ValidateOptions

Defined in:
lib/foreman_maintain/core_ext.rb

Instance Method Summary collapse

Instance Method Details

#validate_options!(*valid_keys) ⇒ Object



16
17
18
19
20
21
22
23
24
# File 'lib/foreman_maintain/core_ext.rb', line 16

def validate_options!(*valid_keys)
  valid_keys.flatten!
  unexpected_options = keys - valid_keys - valid_keys.map(&:to_s)
  unless unexpected_options.empty?
    raise ArgumentError, "Unexpected options #{unexpected_options.inspect}. "\
      "Valid keys are: #{valid_keys.map(&:inspect).join(', ')}"
  end
  self
end