Ruby enumerated list
Use like this:
enum :FIRST, :SECOND, :THIRD
1 2 module Util 3 # Basic enumerated list. 4 def enum(*symbols) 5 # Start out the count at 0. 6 i = 0 7 8 # Define a constant for each symbol in symbols, assigning it the current value 9 # of i. 10 symbols.each { |s| const_set(s, i);i += 1 } 11 end 12 end