From: "Jesús Gabriel y Galán" Date: 2010-04-12T05:10:12+09:00 Subject: Re: Hash name increment on iteration? On Sun, Apr 11, 2010 at 5:32 PM, Li Chen wrote: > 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"? When there's no explicit receiver, the method call happens on the object that is "self" at that point. Jesus.