Understanding Ruby's defined? Keyword
Ruby's defined? keyword is an elegant way to check if a variable is defined or not and also to cache expensive operations. However, it's confusing, and a few gotchas await the new Rubyist. Now that I've had a few opportunities to play with it, here’s my shot at sparing you some of the confusion.