From: Austin Ziegler Date: 2005-04-26T22:28:46+09:00 Subject: Re: Mixins for *objects*? On 4/26/05, John Lam wrote: > I'm trying to do something somewhat esoteric. I'm trying to mix in some additional functionality to WIN32OLE objects to avoid having to create a wrapper object that simply delegates functionality. > > Imagine: > > dir = WIN32OLE.connect("some moniker that returns a directory") > > Let's say that I had a class that defined some helper methods like Ruby iterators: > > class Dir > ... > end > > Is it possible to mix dir with Dir at runtime easily without adding methods at runtime etc? Try: dir = WIN32OLE.connect("some moniker that returns a directory") module Dir ... end dir.extend(Dir) -austin -- Austin Ziegler * halostatue@gmail.com * Alternate: austin@halostatue.ca