>> On Tue, Nov 25, 2008 at 9:38 AM, Zach >> Dennis <[EMAIL PROTECTED]> wrote:
>>> The virtual class of an object (class or instance alike) gives you >>> the ability to modify the object in ways that a simple class method >>> usually does not allow. In particular, when implementing a singleton this way, it’s possible to access instance variables of the singleton (rather than having to work on class variables). >>> My rule of thumb is to use it when I can't easily achieve the >>> same result using other mechanisms, but not to use it just cause'. Ditto. I basically use it for singleton classes (Log, Config) only. David Chelimsky: > One thing Chris points out in his blog is that 'def self.method_name' > is perfectly fine, and that it makes refactoring easier. My experience > is different, because I'm often searching for methods with 'def > method_name' - this is actually one of the reasons I have preferred > 'class << self'. PHP with its ‘function &returningAReference(…)’ syntax taught me to grep for function.*name, so I now simply grep for def.*method_name in Ruby (granted, it doesn’t work too well if you have other methods with ‘method_name’ inside their names). -- Shot -- Exchange actually reports two different INTERNALDATEs for the exact same message when queried at different points in time. [...] Of course no OTHER imap server I've encountered returns DIFFERENT values for the SAME message. But it's Microsoft; what do you expect? If their programmers were any good they'd be working at Google. -- sup/imap.rb
pgp9TaTjgos6E.pgp
Description: PGP signature
_______________________________________________ rspec-users mailing list [email protected] http://rubyforge.org/mailman/listinfo/rspec-users
