From: Christoph Date: 2002-06-06T20:42:41+09:00 Subject: Re: dynamic attr_accessor?? "Holden Glova" wrote in .... > I don't understand, can you please explain? Well assuming --- class A def initialize(name) type.send(:attr_accessor,name) send("#{name}=",name) end end mamas = A.new('cat') papas = A.new('dog') p papas.dog # => nil p mamas.cat # => nil # since cat and dog are A instance methods --- on the other hand --- class A def initialize(name) class << self; self end.send(:attr_accessor,name) send("#{name}=", name) end end mamas = A.new('cat') papas = A.new('dog') p papas.dog # p mamas.cat # # both raise a non-method errors since cat and dog are # singleton methods of mama and papa respectively. --- Thus, as in the ``class_eval'' situation (see Nabu's comments in another branch of the thread) , you have two semantically different ``send'' solutions ... /Christoph