module PinballWizard::Helpers::Hash

Public Instance Methods

normalize_options(options) click to toggle source

Convert [:a, :b, { c: ā€˜d’ }] => { a: true, b: true, c: ā€˜d’ }

# File lib/pinball_wizard/helpers/hash.rb, line 8
def normalize_options(options)
  options.each_with_object({}) do |opt, memo|
    if opt.is_a?(::Hash)
      memo.merge!(opt)
    else
      memo[opt] = true
    end
  end
end
without(hash, *keys) click to toggle source
# File lib/pinball_wizard/helpers/hash.rb, line 18
def without(hash, *keys)
  keys.each do |key|
    hash.delete(key)
  end
  hash
end