From: Brian Xue Date: 2011-05-13T08:57:27+09:00 Subject: Re: where does the pure method defined when starting irb --001517440fd06a896d04a31ce67e Content-Type: text/plain; charset=ISO-8859-1 Thanks all for your kindly explanation. It really helps. Brian 2011/5/13 7stud -- > Christopher Dicely wrote in post #998250: > > On Thu, May 12, 2011 at 2:40 AM, Brian Xue 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 < > => true > > > > Also: > > puts RUBY_VERSION > > x = class A > end > > p x > > x = class < end > > p x > > --output:-- > 1.9.2 > nil > nil > > > === > > -- > Posted via http://www.ruby-forum.com/. > > --001517440fd06a896d04a31ce67e--