Module: SleipnirAPI::Profile::OptionArgument
- Includes:
- OptionUtil
- Included in:
- SleipnirAPI::Profile, ProfileElement
- Defined in:
- lib/sleipnir_api/profile/util.rb
Overview
:nodoc:
Instance Method Summary collapse
Methods included from OptionUtil
Instance Method Details
#options(opts, *valid_keys) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/sleipnir_api/profile/util.rb', line 14 def (opts, *valid_keys) if opts and not Hash === opts raise ArgumentError, "Invalid options: #{opts.inspect}:#{opts.class} (expected Hash)" end r = @default_opts ? @default_opts.dup : {} valid_keys = [:cipher, :ini, :default] if valid_keys.empty? if opts invalid = (opts.keys - valid_keys).inject({}){|acc,e| acc[e] = opts[e]; acc } unless invalid.empty? raise ArgumentError, "Invalid options: #{invalid.inspect}" end r.update(opts) end r end |