Hi --

On Thu, 13 Dec 2007, Jeff wrote:

>
> matthew deiters wrote:
>> Ever need to do !object.nil? - I do and frequently. This patch is
>> basically rolling up an extension i end up adding to every project i
>> work on.
>
> Um... why not just do
>
> if object ....
>
> Should be the same as !object.nil?, right?

Almost. The edge case is when object is false. !false.nil? is true,
but the if test will fail.  It's unusual for that case to matter,
though it's not impossible that it could.


David

-- 
Training for 2008!
Ruby on Rails training by David A. Black/Ruby Power and Light, LLC:
    * Intro to Rails, New York, NY, February 4-7 2008
    * Advancing With Rails, New York, NY, February 11-14 2008
Hosted by Exceed Education. See http://www.rubypal.com for details!

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to