Classificação de chave de hash Ruby

sorted_map = {}
# asc
unsorted_map
.sort.each {|key, val| sorted_map[key] = val}
# desc
# unsorted_map.sort.reverse.each {|key, val| sorted_map[key] = val}