Hacker News new | ask | show | jobs
by 33degrees 2364 days ago
In Ruby, nil is a singleton instance of NilClass, and defines #nil?, as well as methods to cast to different types e.g. nil.to_a == []. Rails goes a bit further and adds #blank?, which is handy for things that might be nil or empty strings.