ちょい改良。これで>>389のいうこともできるかな。

module Each
 def map(e = :each, &block)
  r = []
  send(e) { |*elem|
   r << block.call(*elem)
  }
  r
 end # def
end

str = "xyz"
str.extend(Each)
p str.map(:each_byte) {|b| '%02x' % b } #=> ["78", "79", "7a"]

arr = [1, 2, 3]
arr.extend(Each)
p arr.map(:each_with_index) {|elem, idx| elem * idx} #=> [0, 2, 6]