From: Christoph Date: 2002-06-04T22:19:30+09:00 Subject: Re: dynamic attr_accessor?? "Holden Glova" wrote in .... > I personally prefer the non-eval way that Guy Decoux recommend of using > type.__send__. Try and not use eval whenever you can IMO - plus I think the > clarity is enhanced in many non-eval solutions. The ``type'' solution defines new A instances methods wether you use class_eval or send - > > irb(main):019:0> class A > irb(main):020:1> def initialize(name) > irb(main):021:2> @name = name > irb(main):022:2> type.__send__(:attr_accessor, "name") class << self; self end.send(:attr_accessor, name) > irb(main):023:2> end .... /Christoph