From: botp Date: 2011-01-24T14:29:48+09:00 Subject: Re: class_eval On Mon, Jan 24, 2011 at 12:58 PM, Lorenzo Brito Morales wrote: >..., but i just want to the class Person was the only class whom have it. then just put it Person eg, class Person def self.add_accessor accessor_name self.class_eval %Q{ attr_accessor :#{accessor_name} } end end #=> nil person=Person.new #=> # Person.add_accessor :name #=> nil Person.add_accessor :gender #=> nil person.name="Peter Cooper" #=> "Peter Cooper" person.gender="male" #=> "male" person.name #=> "Peter Cooper" person.gender #=> "male" best regards -botp