On Aug 10, 9:22=A0pm, Patrick Li <patrickli_2... / hotmail.com> wrote:
> Hi,
> I thought I understood this, but apparently not.
>
> What is this object exactly?
> o =3D class << String; self; end
>
> From my understanding:
> p o
> and
> p String
> should output the same thing.
>
> but it doesn't
> p o #<Class:String>
> p String #String
>
> Thanks for answering such a basic question for me.
> =A0 -Patrick
> --
> Posted viahttp://www.ruby-forum.com/.

In your example, String is an instance of Class, and o is the
eigenclass (or metaclass) of String.  Maybe this will help clarify:

  o =3D class << String; self; end
  o.class_eval do
    def backwards
      'gnirtS'
    end
  end

  String.backwards  # =3D> "gnirtS"

HTH,
Chris