From: Lorenzo Brito Morales Date: 2011-01-24T13:58:10+09:00 Subject: class_eval I cant not understand why these code is well class Class def add_accessor(accessor_name) self.class_eval %Q{ attr_accessor :#{accessor_name} } end end class Person end person = Person.new Person.add_accessor :name Person.add_accessor :gender person.name = "Peter Cooper" person.gender = "male" puts "#{person.name} is #{person.gender}" and these not work class Person def add_accessor(accessor_name) self.class_eval %Q{ attr_accessor :#{accessor_name} } end end person = Person.new Person.add_accessor :name Person.add_accessor :gender person.name = "Peter Cooper" person.gender = "male" puts "#{person.name} is #{person.gender}" in the first group of code, the code is added to the class Class, so any class has the method add_accesor, but i just want to the class Person was the only class whom have it. Im just reading a book, and it says that they put the code in the class Class just to all the class has the method.