From: Robert Dober Date: 2006-09-29T00:46:31+09:00 Subject: Re: New magical version of Symbol.to_proc ------=_Part_54959_7030742.1159458388221 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline I just could not resist, I am still amazed - after 20 years of Ruby experience 8-], how easily things can be done, when did I say Ty the last time Matz? Probably 20 years ago!!! Ty Matz!!! for those who like the notation, very, very lazily tested, but amazingly simple, probably rather slow etc.... --------------------- 8< --------------------- module Enumerable class MapProxy def initialize obj @obj =3D obj end #def initialize obj def method_missing name, *args, &blk @obj.map do | ele | ele.send name, *args, &blk end end #def method_missing name, *args, &blk end #class MapProxy alias_method :aliased_map, :map def map *args, &blk return MapProxy.new( self ) if args.length.zero? && blk.nil? aliased_map *args, &blk end #def map *args, &blk end #module Enumerable ---------------- 8< -------------------- Cheers Robert --=20 Deux choses sont infinies : l'univers et la b=EAtise humaine ; en ce qui concerne l'univers, je n'en ai pas acquis la certitude absolue. - Albert Einstein ------=_Part_54959_7030742.1159458388221--