From: Ryan Davis Date: 2009-03-02T15:47:53+09:00 Subject: Re: Delegating class methods On Mar 1, 2009, at 12:33 , abc wrote: > how would you forward calls from class methods to a class atribute? I'm not thrilled that you have to use a class method to access the attribute, but this works: > class Foo > extend SingleForwardable > def self.hash; @@hash ||= {}; end > def_delegators :hash, :size, :keys > end > > p Foo.size > p Foo.keys It'd be ideal if you could use :@@hash for the delegators line, but I couldn't get that to work easily.