Better than methodphitamine?
I think this one is prettier (but maybe not as sophisticated):
1 2 module Enumerable 3 def method_missing(sym, *args) 4 if (sym.to_s =~ /^(.+)_with$/) && (msg = args.shift) 5 send($1.to_sym) do |x| 6 x.send(msg, *args) 7 end 8 end 9 end 10 end 11 12 [1, 2, 3].map_with :to_s 13