From: Ryan Davis Date: 2011-02-14T05:37:11+09:00 Subject: Re: DCI and ruby On Feb 13, 2011, at 02:51 , Michel Demazure wrote: > The following post is interesting > > http://andrzejonsoftware.blogspot.com/2011/02/dci-and-rails.html > > In the DCI way, an object can be assigned a role by extending a module > bringing the methods pertaining to this role > > obj = Klass.new > obj extend Role > > But, how to change roles, without cluttering the metaclass hierarchy ? > > obj unextend Role # ? I wrote the 'un' gem which has uninclude and unextend. Passes tests on 1.8 and 1.9. Tho I've got to say that I'm not sure what DCI does that decorations don't. Seems this can all be done via composition and delegation quite easily. *shrug*