From: Brian Adkins Date: 2007-10-28T04:05:06+09:00 Subject: Re: .each do |foo, bar| what does bar do? On Oct 27, 7:05 am, "David A. Black" wrote: > If you were going to write Hash#each in Ruby, without recourse to > #each, you could write it like this: > > class Hash > def each > keys = self.keys # make a 'keys' local variable > i = 0 > until i == keys.size > key = keys[i] > yield(key, self[key]) > i += 1 > end > self > end > end Or this: class Hash def each each_key {|key| yield key, self[key] } end end I know, you meant w/o recourse to each* :)