Module: PinballWizard::Helpers::Hash
- Defined in:
- lib/pinball_wizard/helpers/hash.rb
Class Method Summary collapse
-
.normalize_options(options) ⇒ Object
Convert [:a, :b, { c: ‘d’ }] => { a: true, b: true, c: ‘d’ }.
- .without(hash, *keys) ⇒ Object
Class Method Details
.normalize_options(options) ⇒ Object
Convert [:a, :b, { c: ‘d’ }] => { a: true, b: true, c: ‘d’ }
8 9 10 11 12 13 14 15 16 |
# File 'lib/pinball_wizard/helpers/hash.rb', line 8 def () .each_with_object({}) do |opt, memo| if opt.is_a?(::Hash) memo.merge!(opt) else memo[opt] = true end end end |
.without(hash, *keys) ⇒ Object
18 19 20 21 22 23 |
# File 'lib/pinball_wizard/helpers/hash.rb', line 18 def without(hash, *keys) keys.each do |key| hash.delete(key) end hash end |