--001517440fd06a896d04a31ce67e
Content-Type: text/plain; charset=ISO-8859-1

Thanks all for your kindly explanation. It really helps.

Brian

2011/5/13 7stud -- <bbxx789_05ss / yahoo.com>

> 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
> >> il
> >>
> >> then where is the method "hello" defined? within Object? but
> >>
> >> self.class.instance_methods.include? :hello
> >> alse
> >
> > 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  lass A
> end
>
> p x
>
> x   lass <<self
> end
>
> p x
>
> --output:--
> 1.9.2
> nil
> nil
>
>
> 
>
> --
> Posted via http://www.ruby-forum.com/.
>
>

--001517440fd06a896d04a31ce67e--