Module: Matchd::Helpers

Defined in:
lib/matchd/helpers.rb

Class Method Summary collapse

Class Method Details

.extract_options(keys, options) ⇒ Object

Creates a new Hash with the key-value pairs of options for the keys given and only if options has that keys. Also, new keys will get symbolized.



8
9
10
11
12
# File 'lib/matchd/helpers.rb', line 8

def extract_options(keys, options)
  keys.each_with_object({}) do |key, o|
    o[key.to_sym] = options[key] if options.key?(key)
  end
end