--- Dan Schmidt <dfan / harmonixmusic.com> wrote: > Gunnar Andersson <dff180 / yahoo.com> writes: > > | # file: AttrInitializer > | class Module > | def attr_initializer(*attrs) > | alist = plist = "" > | attrs.each do |v| > | alist += "@#{v}," # >> @var1,@var2,@var3, > ... > | plist += "#{v}," # >> var1,var2,var3, ... > | end > | alist.chop!; plist.chop! # Remove last comma > | class_eval "def initialize(#{plist}); #{alist} = > #{plist}; end" > | end > | end > > Perhaps the generated initialize method could also check > for the presence of a initialize_more (or a better name, > hopefully) method and call it if it exists. I was thinking that it would be nice if you could pass in a block. The last thing attr_initializer would do before returning would be to yield. I like it (and the optionally-reflective equality-checker)! Kevin __________________________________________________ Do You Yahoo!? Make a great connection at Yahoo! Personals. http://personals.yahoo.com