From: Igal Koshevoy Date: 2008-06-27T03:41:42+09:00 Subject: Re: question about defined? and y Aditya Mahajan wrote: > On Thu, 26 Jun 2008, Ruby Freak wrote: >> The uninitialized variable y returns from defined? as "method" rather >> than "nil" ???? >> >> puts defined?(x) # => nil >> >> puts defined?(y) # => method > > Are you testing this on irb or by writing on a file and running > through ruby? When I test this on irb, both x and y are defined as > methods. While running through ruby, both are nil. If you're using an IRB with certain settings, such as the Rails console, it includes the "y" method as a wrapper providing functionality similar to: def y(*args) require 'yaml' print YAML::dump(args) end This command is useful for inspecting data structures. -igal