Before(:each) hard to emulate / capture?

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 B.

Podcast: http://hollywoodgrit.blogspot.com
Blog: http://gilesbowkett.blogspot.com
Portfolio: http://www.gilesgoatboy.org
Tumblelog: http://giles.tumblr.com

On Jan 1, 2008 6:42 PM, Giles B. [email protected] wrote:

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

http://ruby-smalltalk.blogspot.com/


All truth passes through three stages. First, it is ridiculed. Second,
it is violently opposed. Third, it is accepted as being self-evident.
Schopenhauer (attr.)

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs