On Wed, 19 Oct 2005, Kevin Ballard wrote:

>> class NilClass
>>    def method_missing(method, *args)
>>       nil
>>    end
>> end
>>
>> Forget the ladder... use the elevator!  ;)
>
> While that certainly works, I would advise not doing that. The problem
> with this is it will hide problems that might show up elsewhere in your
> code.


Yes yes we have had this on out all before... The answer is nil is 
overloaded to mean several things. eg. Not initialized and Not Applicable.

So how about..

class ReDuckulous
   # I just Quack myself up...
   def someattribute
     self
   end

   def dosomething
     self
   end
end

DAFFY = ReDuckulous.new

def mymethod
   a = somereference('a')
   a = DAFFY unless a # What's up Doc?
   a.someattribute.someattribute.dosomething
end


John Carter                             Phone : (64)(3) 358 6639
Tait Electronics                        Fax   : (64)(3) 359 4632
PO Box 1645 Christchurch                Email : john.carter / tait.co.nz
New Zealand

Carter's Clarification of Murphy's Law.

"Things only ever go right so that they may go more spectacularly wrong later."

From this principle, all of life and physics may be deduced.