Ruby/Hash/clear
Материал из Wiki.crossplatform.ru
(Различия между версиями)
Версия 17:10, 26 мая 2010
clear a hash
counties = { "Three" => 3, "Five" => 5 } counties.clear # bye-bye
clear method removes all the key-value pairs from a hash, leaving it empty
counties = { "Three" => 3, "Five" => 5 } counties.clear # bye-bye counties.empty? # => true