On Tue, 31 Jul 2001, Bill Kelly wrote: > > Any further improvements would be most welcome - for now I've changed > it to use attr_accessor and dispensed with the get/set style entirely. > Seemed acceptable to me (and somewhat typical, right?), however, I don't > yet know how to use metaclasses to provide the get/set convention you > describe(!) > class Class def braindead_attr(name) u=name.to_s.capitalize class_eval "def get#{u} ; @#{u} ; end" class_eval "def set#{u}(v); @#{u} = v; end" end end class Foo braindead_attr :x braindead_attr :y braindead_attr :radius end p Foo.instance_methods matju