On 8/2/05, Ara.T.Howard <Ara.T.Howard / noaa.gov> wrote:
> 
> hmm.  this is a bit shorter
> 
>    harp:~ > cat a.rb

>    class Object
>      def enum(*list)
>        mc = Module === self ? self : self.class
>        list.flatten.each_with_index{|e, i| mc.const_set e.to_s.intern, i}
>      end
>      def bit_enum(*list)
>        mc = Module === self ? self : self.class
>        list.flatten.each_with_index{|e, i| mc.const_set e.to_s.intern,  2 ** i}
>      end
>    end

Wow.  Very nice.  Works great in my script.  Thanks!

-- 
Garance Alistair Drosehn     =             drosihn / gmail.com
Senior Systems Programmer               or   gad / FreeBSD.org
Rensselaer Polytechnic Institute;             Troy, NY;  USA