On Apr 11, 2008, at 7:41 AM, I=F1aki Baz Castillo wrote:
>
> At the beggining "headers_array" just contain "Header" objects but
> after inspection I want to replace the header with @name=3D'From' with =
a
> "From" object but since "name" and "body" attributes are the same I
> don't want a memory copy operation to allocate space for new object.
>
> This is: I just want to change the Class of a "Header" object to
> "From" class, keeping the attributes without memory copy operation, is
> there any way? I imagine in C I'd do it by using pointers.

You can not change the class of an object in Ruby.

You'll have to instantiate a new object and copy the
attributes.  If you just do something like:

from_obj.name =3D header_obj.name

You are simply copying object references, you aren't
copying all the associated data.

Gary Wright=