How to make "quit" at the end of "menu"


#1

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”}


#2

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”}


#3

On Sun, May 06, 2007 at 07:32:14AM +0900, Gpy Good wrote:

{“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”}

If ordering is important, don’t use a hash.

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