class Object
    def nil_or
      return self unless self.nil?
      Class.new do
        def method_missing(sym,*args); nil; end
      end.new
    end
  end
  
FAQ
Q:  What is nil_or?
A:  nil_or is an extension to the Object class in ruby.

Q:  What does nil_or do?
A:  nil_or will return the object that calls it or an
    ambiguous class with only one method.

Q:  Why would I use nil_or?
A:  You are a consulting company being paid to train
    your .net developers on an expensive Ruby contract.

Q:  How do I use nil_or?
A:  You would make a call like this...
    "example string".nil_or.split

Q:  In your example it seems nil_or really didn't do anything.
A:  Correct! nil_or will just return the object that called
    it unless that object is nil. If the object is nil
    nil_or returns an class that only has method_missing
    returning nil.

Q:  Could I not check if the object is not nil before
    calling my method?
A:  You should and most poeple do.
Questions, Comments, Concerns? Please email me at wtf@nil-or.com