O
Oleg Kh
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.
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.