Ruby Blocks and Template Method Pattern


#1

I was reading the Programming Ruby book yesterday and the explanation
for Ruby blocks sounded very similar to Template Method pattern that I
used in other object-oriented languages.

Is my understanding correct? TIA


#2

On 2/5/07, removed_email_address@domain.invalid removed_email_address@domain.invalid wrote:

I was reading the Programming Ruby book yesterday and the explanation
for Ruby blocks sounded very similar to Template Method pattern that I
used in other object-oriented languages.

Is my understanding correct? TIA

Yes, that’s one way of looking at it. Using blocks can be like
“filling in the blank” in a template method.