before(:each) hard to emulate / capture?

R

Robert Dober

Is there an easy way for a class to incorporate an existing module but
also stipulate that it will capture any value returned by the methods
in that module into one ivar?

--
Giles Bowkett

Podcast: http://hollywoodgrit.blogspot.com
Blog: http://gilesbowkett.blogspot.com
Portfolio: http://www.gilesgoatboy.org
Tumblelog: http://giles.tumblr.com
Sorry Gilles I have no Ruby and an impossible keyboard at hand, but
the basic idea would be

module M ...
def self.included into_mod
methodes.each do ! mn !
m = method mn
into_mod.send( :module_eval, "def #{mn} *args, &blk;
@{mn}=super(*args,&blk);end" )
etc.etc.

HTH
Robert
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,153
Members
46,699
Latest member
AnneRosen

Latest Threads

Top