From: Brian Candler Date: 2008-10-23T03:32:34+09:00 Subject: Re: extending object with another object Ittay Dror wrote: > Brian Candler wrote: > >> belonging to the second object? >> > I want just to get the methods defined in the second object, something > like > object.extend(as_module(other_object)) > > where 'as_module' is some method that returns a module representing the > class hierarchy (with singletons) of the other object. But I still don't know what the *purpose* of this is, i.e. what actual problem you're trying to solve, and without that I can't propose a better solution. What you're asking for is not especially easy to do. I guess you could iterate over the methods of B, obtain UnboundMethod objects, and bind them to A. But I've never come across any situation where I've needed (or wanted) to do this. -- Posted via http://www.ruby-forum.com/.