On Sep 7, 2007, at 7:52 PM, Giles Bowkett wrote: > > Out of several excellent alternatives to my code I think this is the > most compelling. i always define this in lib/rubyext.rb def singleton_class &b sc = class << self self end b ? module_eval(&b) : sc end then singleton_class.attr_accessor 'foo' or, better singleton_class do attr 'a' attr 'b' end it's a sin to define a method that has a compelling use for a block to silently ignore said block. another thing i use often is attributes, this lets you do this singleton_class do attribute 'foo' end which gives self.foo = 42 #=> @foo = 42 foo 42 #=> @foo = 42 foo #=> 42 foo? #=> true it's attr_accessor in steriods and a very very short lib. (gem install attributes) kind regards. a @ http://drawohara.com/ -- we can deny everything, except that we have the possibility of being better. simply reflect on that. h.h. the 14th dalai lama