Method: Hash#unprotect_keys!

Defined in:
lib/extlib/hash.rb

#unprotect_keys!Object

Attempts to convert all string keys into Class keys. We run this after reloading to convert protected hashes back into usable hashes.

Examples:

# Provided that classes One and Two are declared in this scope:
hash = { "One" => 1, "Two" => 2 }.unproctect_keys!
hash # => { One => 1, Two => 2 }


239
240
241
242
243
# File 'lib/extlib/hash.rb', line 239

def unprotect_keys!
  keys.each do |key|
    (self[Object.full_const_get(key)] = delete(key)) rescue nil
  end
end