-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Am 18.07.2011 13:19, schrieb Markus Fischer: > On 18.07.2011 13:05, Robert Klemme wrote: >> Have you been referred to #each_with_index already? > > Do you mean Array#each_index ? >> >> array.each{|entry, index| p index if entry == "out" } > > Because in the example you still used "each" :) > > Somehow I did know about that behavior of Array#each_index but yet I > couldn't find it on http://www.ruby-doc.org/core/classes/Array.html > . > > I don't know, I can't stop my habit of using ruby-doc.org as my #1 > source although it falls short every now and then. I've been pointed > to other sites already but come back to this one always, it feels > somehow "official" although my understanding is it isn't (and that > there is none). Array#each_index is definitely there: http://ruby-doc.org/core/classes/Array.html#M000232 For the other #each methods you may have to look at the Enumerable module which Array mixes in: http://ruby-doc.org/core/classes/Enumerable.html Vale, Marvin -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQEcBAEBAgAGBQJOJFAEAAoJELh1XLHFkqhafEgIAKql71g6NuEzqOP+rbeWD2GV w2Chdg15JvISOv8a3LFPt75+T2/HukzU6IbyjHJxJLEZuMNMZh2v6LuvkJ7F2XB4 E2fcGPUczR6iP8IknYiqQDPi+GmnIbbLb02vCcN870KzhRUT+1EDNsbxHp2dJCd/ ypt0h5LDlHYkUM9FTXhAfrxOgOWwvKx42zqVBdpnfMa7Ag57NPdum1Um2efCD+OC GKZQwOb4Jtm5XPQQYQ4hBzDdeRkcpw2Mif5lDPJZNS+Obz4498Hx9OAlisW/fQ00 /fI6Ue5atilBF3Ozzvt6+MW3yGbBU+JOubNWr9c2rrhOGYga1ExRWMv/zdX3uUw= =BCWn -----END PGP SIGNATURE-----