Try:

!!defined? x

The "!!" should take care of your nil situation when you want a true/
false. If "defined?(y)" is returning "method", that means you
previously def'ed y ... maybe even in your .irbrc file (if called from
irb).