Summary

The object-oriented paradigm tends to make us see things in terms of what they are instead of what they do. To communicate in the form of instructions rather than objects, Ruby provides the mechanism of passing blocks to iterators. We have used iterators before; today we learned to write them ourselves.

We also were introduced to procedure objects, which wrap blocks up so that they can be assigned to variable names and passed around just like other objects.

Before we can produce truly reusable code (or, as some folks say, reuseful code), we'll need to know how to design nice intuitive interfaces. So tomorrow we'll be using what we learned today to follow up on the discussion from Day 11. The goal will be kind of informal protocol, or ...

Get Sams Teach Yourself Ruby in 21 Days now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.