From: Philip Mak Date: 2002-08-27T07:14:19+09:00 Subject: Hybrid hash and array? When programming radio buttons on a website, I find myself using this sort of construct a lot: @choices = [ ['1', 'Spring'], ['2', 'Summer'], ['3', 'Fall'] ] @table = {} @choices.each do |key, value| @table[key] = value end The data structure I really want is like a hash, except that it maintains its key/value pairs in the order that I defined them. Or, looking at it another way, I want an array of arrays, except that it can be accessed using the key (where the key is the first element of each array inside the outer array). Currently, I define it as an array of arrays, and then have a bit of code to convert it into a hash. Then when I need it in order, I use the array, and when I need to lookup by key, I use the hash. Is there a built-in class that Ruby has which would automate this?