Ruby presents a variety of ways to get to the same solution and also many ways to get to a slightly different solution. One such situation is with the difference between present?
and nil?
present?
checks any object and returns false if the object is nil, false, empty, or has a white space string. It is the exact opposite of blank?
nil?
checks and object and returns true when the object is not nil or returns false if the object has something in it. Essentially it only returns true when the object is in fact nil.
These subtle variations can be very important at times, especially at times of error catching and validation checking.
Just some thoughts keeping my brain occupied these past couple of months…
Stay tuned…