From: 7stud -- Date: 2011-04-16T08:10:05+09:00 Subject: Re: What do you do when you need to attach data to an object instance? Kevin Mahler wrote in post #992907: > > def extend_accessor(obj, name) > obj.singleton_class.module_eval { attr_accessor name } > obj > end > Hey, now. obj.singleton_class is a class so how about using the synonym class_eval(): obj.singleton_class.class_eval { attr_accessor name } -- Posted via http://www.ruby-forum.com/.