Hi --

On Mon, 11 Dec 2006, S. Robert James wrote:

>
> dblack / wobblini.net wrote:
>> In case it got lost in my reply to my reply: have a look at:
>>
>> http://raa.ruby-lang.org/project/import_module/
>
> Thanks.  That's quite a hefty module - with method am I interested in?

I'm thinking something like (untested):

   module M
     def join
       "I'm a new version of join!"
     end
   end

   arr = [1,2,3]
   Array.import_module(M) do
     puts foo.join           # I'm a new version of join!
   end
   puts foo.join             # 123

so that you'd be temporarily layering different versions of the
method(s).


David

-- 
                   David A. Black | dblack / wobblini.net
Author of "Ruby for Rails"   [1] | Ruby/Rails training & consultancy [3]
DABlog (DAB's Weblog)        [2] | Co-director, Ruby Central, Inc.   [4]
[1] http://www.manning.com/black | [3] http://www.rubypowerandlight.com
[2] http://dablog.rubypal.com    | [4] http://www.rubycentral.org