Christopher Dicely wrote in post #998250: > On Thu, May 12, 2011 at 2:40 AM, Brian Xue <brxue.cn / gmail.com> wrote: >> >> def hello; end >> =>nil >> >> then where is the method "hello" defined? within Object? but >> >> self.class.instance_methods.include? :hello >> =>false > > Right, because its not defined as an instance method in the Object > class, its defined as an instance method in the singleton class of the > current object (main). > > So, in IRB for Ruby 1.8.7 after the above > > (class <<self; end).instance_methods.include? "hello" > => true > Also: puts RUBY_VERSION x = class A end p x x = class <<self end p x --output:-- 1.9.2 nil nil === -- Posted via http://www.ruby-forum.com/.