From: Markus Date: 2004-09-24T13:47:55+09:00 Subject: Re: enum pattern Just to get you thinking in other directions (WARNING: THIS CODE WAS TYPED OFF THE TOP OF MY HEAD AND HAS NOT BE DEBUGGED (OR EVEN RUN)): class DaysOfWeek < string Names = %w{ monday tuesday wednesday thursday friday saturday sunday } Objects = Hash.new Names.each { |day| eval %Q{ def DaysOfWeek.#{day} Objects["#{day}"] ||= DaysOfWeek.new("#{day}") end } } def DaysOfWeek.to_list Objects.values end def DaysOfWeek.from_s(content) Objects[content] end private def initialize(str) super(str) end end Something along these lines would do pretty much what the original did. -- MarkusQ