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

**URL:** <https://www.ruby-forum.com/t/how-to-make-quit-at-the-end-of-menu/103434>\
**Category:** Ruby\
**Created:** [May 6, 2007, 12:32am UTC](https://www.ruby-forum.com/t/how-to-make-quit-at-the-end-of-menu/103434 "2007-05-06T00:32:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![gpygood](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/67e7ee/32.png) [@gpygood](https://www.ruby-forum.com/u/gpygood)\
**Post date:** [May 6, 2007, 12:32am UTC](https://www.ruby-forum.com/t/how-to-make-quit-at-the-end-of-menu/103434/1 "2007-05-06T00:32:12Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![gpygood](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/67e7ee/32.png) [@gpygood](https://www.ruby-forum.com/u/gpygood)\
**Post date:** [May 6, 2007, 12:37am UTC](https://www.ruby-forum.com/t/how-to-make-quit-at-the-end-of-menu/103434/2 "2007-05-06T00:37:46Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![gpygood](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/67e7ee/32.png) [@gpygood](https://www.ruby-forum.com/u/gpygood)\
**Post date:** [May 6, 2007, 9:25am UTC](https://www.ruby-forum.com/t/how-to-make-quit-at-the-end-of-menu/103434/3 "2007-05-06T09:25:08Z")

</div>

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’],  
]
