class Hash def force!(*keys) keys.each { |key| self[key] ||= '' } end def force_and_slice!(*keys) force!(*keys) slice!(*keys) end end