Ruby/Hash/include
Материал из Wiki.crossplatform.ru
(Различия между версиями)
Версия 17:10, 26 мая 2010
Delete from hash
h = {:a=>1, :b=>2} h[:a] = nil # h now holds {:a=> nil, :b=>2 } h.include? :a # => true h.delete :b # => 2: returns deleted value: h now holds {:a=>nil} h.include? :b # => false h.delete :b # => nil: key not found