From: botp Date: 2011-01-24T15:20:11+09:00 Subject: Re: class_eval On Mon, Jan 24, 2011 at 1:46 PM, Lorenzo Brito Morales wrote: > Ok, thanks, in that way what actually we are doing is a class method yes. a class method > not? a static called in java or csharp similar > but the thing i really feel very weird is these > 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 > but why the method added to Class works on Person as class method ? if > it is added in Class as instance method ? that means, Person is an instance of class Class ie when you do, class Person end ruby treats it as Person=Class.new best regards -botp