M
Michel Demazure
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 # ?
obj extend NewRole
But, even with an ah-hoc unextend, one needs to remember the old role.
Therefore, what about a 'temp_extend Module' method, which clears the
previous 'temp_extension' ?
_md
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 # ?
obj extend NewRole
But, even with an ah-hoc unextend, one needs to remember the old role.
Therefore, what about a 'temp_extend Module' method, which clears the
previous 'temp_extension' ?
_md