From: Andreas Habel Date: 2005-05-03T02:59:31+09:00 Subject: Re: enum in ruby ? mark sparshatt wrote: > The following is a simple implementation of what you want > > > class Class > def const_def(*symbols) > symbols.each_with_index do |symbol, index| > const_set(symbol, index + 1) > end > end > end > > class MyClass > const_def :CONST_A1, :CONST_A2, :CONST_A3 > > p CONST_A1, CONST_A2, CONST_A3 > end > > #=> > 1 > 2 > 3 > > > HTH > > -- > Mark Sparshatt > Thanks to all for your fast answers! That`s perfect, const_set is the miracle I searched for ;) Andreas