From: Robo Date: 2004-10-12T14:39:40+09:00 Subject: Re: Ruby programming styles and new program? Bill wrote: > One problem: I cannot find documentation for the Dir.inject method. I > assume from some of the Ruby docs this is like the Smalltalk inject > method, but I don't know why it's not documented in the Dir class? > The Dir class includes the Enumerable module (like most classes that has a 'each' method), and that module has the inject method. > Anyway, what, exactly, is happening in the line (typo removed) > > > moved = dir.inject(0) do |count, logfile| > > and how do you know to put the | count, logfile | variables in that > order, and not | logfile, count | ? > Go to the doc for Enumerable#inject and you'll see the description for it. Robo