--0016e6dbe945f9b95b048e7e9fa4
Content-Type: text/plain; charset=UTF-8

So somewhere (at least conceptually) there's a definition that goes
something like this:

class Object
  def to_s
    class_name  elf.class.name
    reference  elf.memory_reference
    " \#<#{class_name}:#{reference}>"
  end
end

On Mon, Aug 23, 2010 at 10:30 AM, Abder-Rahman Ali <
abder.rahman.ali / gmail.com> wrote:

> Andrew Wagner wrote:
> > #<Foo...> just means "an instance of the class Foo". That crazy hex at
> > the
> > end (0x...) is just the reference to the instance in memory, so that,
> > you
> > could tell two different instances apart.
> >
> > Basically, what's happening here is that there's a default instance of
> > to_s
> > which knows how to look up what class the object is an instance of, look
> > up
> > the memory reference, and return that string. When you define to_s
> > yourself,
> > you're overriding that default implementation to return something that's
> > (hopefully) more useful for you.
> >
> > On Mon, Aug 23, 2010 at 10:08 AM, Abder-Rahman Ali <
>
> Thanks a lot Andrew. It is becoming more clear now. I'm just still not
> getting this point if you just can explain it further:
>
> asically, what's happening here is that there's a default instance of
> to_s which knows how to look up what class the object is an instance of,
> look
> up the memory reference, and return that string.
> --
> Posted via http://www.ruby-forum.com/.
>
>

--0016e6dbe945f9b95b048e7e9fa4--