From: Dave Burt Date: 2005-04-30T08:54:29+09:00 Subject: Re: determining when inside 'class << self' queried: > now - any opinions on whether this violates POLS or not: > > # > # my attributes module - hoping to become a collection of better 'attr' > like > # metamethods... > # > require 'attributes' > class C > # define a class attr => used like C::foo > class_attribute 'foo' > # define an instance attr => C::new.bar > attribute 'bar' > class << self > # define a class attr => used like C::foobar > attribute 'foobar' > end > end The way it works is analogous to "def attribute_name", which is unsurprising. I like it. I also like the setter capability of the getter methods (setting attributes in a block passed to the constructor looks very clean), and I'm sure I'll be using your module a in future. Cheers, Dave