Ruby/Hash/rehash

Материал из Wiki.crossplatform.ru

Перейти к: навигация, поиск

rehash Rebuilds the hash based on the current hash values for each key.

a = [ "a", "b" ]
c = [ "c", "d" ]
h = { a => 100, c => 300 }
h[a]  
a[0] = "z"
h[a]  
h.rehash
h[a]