From: Robert Klemme Date: 2012-08-17T23:50:49+09:00 Subject: Re: :symbol vs CONSTANT choice On Thu, Aug 16, 2012 at 11:37 PM, Charles Hixson wrote: > I have a list of about 12 items that I wish to repeatedly store as part of a > record in a file. The obvious way to do this is to define a bunch of > constant terms with values [1 .. 12]. But when I want to use them in the > program, symbols would be more convenient. Is there a better way to do this > than just defining the constants, and using a pair of functions to convert > to and from symbols? There are some approaches to do enums in Ruby out there, e.g. http://code.dblock.org/how-to-define-enums-in-ruby http://stackoverflow.com/questions/75759/enums-in-ruby http://www.lesismore.co.za/rubyenums.html You'll find plenty more with your favorite search engine. Other than that the two function approach probably works as well. Or you use two Hashes for both directions and not two functions. Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/