Topic: how to make "quit" at the end of "menu"

I create a ruby program that need a menu from database:
menu={
"open file"=>"file.html",
"save file"=>"save_file.html",
"quit"=>"quit.rb"
}

puts menu.inspect

=>
{"open file"=>"file.html", "quit"=>"quit.rb", "save
file"=>"save_file.html"}

BUT,i hope that as I create menu's ordered
=>
{"open file"=>"file.html", "save
file"=>"save_file.html","quit"=>"quit.rb"}


or,Is there have a hash method like to_map ?

puts menu.to_map.inspect
=>
{"open file"=>"file.html", "save
file"=>"save_file.html","quit"=>"quit.rb"}

Re: how to make "quit" at the end of "menu"

Hashes are unordered lists, so there's no simple way to make them ordered (correctly).

What you could try is an array of arrays like so:

menu=[
["open file", "file.html"],
["save file", "save_file.html"],
["quit", "quit.rb"]
]

That should work until Ryan comes along with a better solution. wink