# Инициализация хэшей h1 = Hash.new h2 = Hash.new "default" h3 = Hash[ a => 1, b => 2 ] h4 = { a => 1, b => 2 } # Методы хэшей h1.has_key? a h1.has_value? 1 h1.keys h1.values h1.values_at a h1.index 1 h1.select { |k,v| k>1 } h1.each { |k,v| puts k } h1 = h2.merge h3 h1.delete a h1.delete_if { |k,v| k>1 } h1.replace n
Ruby Справочник v0.05 © 2007-2024 Igor Salnikov aka SunDoctor