From: Martin DeMello Date: 2002-11-28T00:32:48+09:00 Subject: _with_index Along the lines of +=... module Enumerable def method_missing(meth, *args, &block) if meth.to_s =~ /_with_index/ m = meth.to_s.gsub('_with_index','') i = -1 self.send(m,*args) {|n| i += 1 block.call(n,i) } end end def myeach(*args, &block) each(*args, &block) end end a = (10..20).to_a b = a.map_with_index {|n,i| n+i} p b a.myeach {|n| p n} a.myeach_with_index {|n,i| p [n,i]} Drawback is, of course, that this might clash with someone else's definition of method_missing. martin