8.4. Conclusion

We’ve taken a good look here at arrays, hashes, and enumerables in general. We’ve seen some similarities between arrays and hashes—most of which are due to the fact that both mix in Enumerable—as well as some differences. We’ve looked at converting between arrays and hashes, and we’ve seen some interesting ways of extending their standard behavior.

We’ve examined common methods of iteration such as each_slice and each_cons. We’ve also seen how enumerator and generator objects work.

In Chapter 9, we again look at high-level data structures. But these will be slightly higher level and may not necessarily be provided as part of the Ruby core or standard libraries. These include sets, stacks, queues, trees, and graphs.

Get The Ruby Way: Solutions and Techniques in Ruby Programming, Second Edition 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.