Method: Hash#protect_keys!

Defined in:
lib/extlib/hash.rb

#protect_keys!Array

Converts all keys into string values. This is used during reloading to prevent problems when classes are no longer declared.

Examples:

hash = { One => 1, Two => 2 }.proctect_keys!
hash # => { "One" => 1, "Two" => 2 }

Returns:

  • An array of they hash’s keys



228
229
230
# File 'lib/extlib/hash.rb', line 228

def protect_keys!
  keys.each {|key| self[key.to_s] = delete(key) }
end