Module: ForemanMaintain::CoreExt::ValidateOptions

Defined in:
lib/foreman_maintain/core_ext.rb

Instance Method Summary collapse

Instance Method Details

#validate_options!(*valid_keys) ⇒ Object



4
5
6
7
8
9
10
11
12
# File 'lib/foreman_maintain/core_ext.rb', line 4

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