From: Li Chen Date: 2010-04-12T00:32:40+09:00 Subject: Re: Hash name increment on iteration? Brian Candler wrote: > Inside it will be implemented something like this: > > module Enumerable > def each_with_index > i = 0 > each do |elem| > yield elem, i > i += 1 > end > end > end > > But you could consider it like this: > > class Array > def each_with_index > size.times do |i| > yield self[i], i > end > end > end Hi Brian, Just some follow-up questions for these codes: I recall the the method call in Ruby follow this format: "receiver.method" So 1) which one is the reciever for "each"? 2) which one is the reciever for "size"? Thanks, Li -- Posted via http://www.ruby-forum.com/.