Oleg Kh wrote: > My problem is as follows: > > book.chapters.find_all{ |chapter| !chapter.pages.empty? }.size > > Theoretically it should return a number of chapters that have pages in > them. However it doesn't do that at all. It simply returns a number of > all chapters. > > On the same note: > > book.chapters.find_all { |chapter| chapter.pages.empty? }.size returns > the same thing as above. > > Identically > > book.chapters.find_all { |chapter| 1 == 2 }.size still returns same > thing (shouldn't that be zero now???) > > And finally > > book.chapters.find_all{ my ass }.size returns exactly the same thing!!! > Seems that whatever is in brackets is simply ignored. > > Any ideas why it does that? BTW, it seems to work just fine for > numerical arrays. > > Thanks. > > -- > Posted via http://www.ruby-forum.com/. Can you send any more context for your use? I've used find_all on many types of arrays w/ .size appended to a block and have no problems with it. Just ran a couple of IRB tests too and all's well. Could it be that your book.chapters is really empty? Have you tried adding a print to your block to ensure its ever being called. Notice that you change the block contents and always get the same result: this implies to me the block is not the issue but what the enumerable has in it, if anything is. Cheers, Ken