March 2009
Intermediate to advanced
194 pages
4h
English
OK, so this has been more theoretically cool than actually cool, partly because this is all a bit of a hassle to use. I’m man enough to admit that. A lot of the problem is that we have to go through three steps (defining the method, making the proc, and calling the method with the proc) when it sort of feels like there should be only two (defining the method and passing the block of code right into the method, without using a proc at all), since most of the time you don’t want to use the proc/block after you pass it into the method.
It should be…more like how iterators work! Sho’ nuff, baby:
class Array |
def each_even(&was_a_block__now_a_proc) |
# We start with "true" because |
# arrays start with 0, ... |