Mastering Ruby Blocks & Iterators

Level-up your Ruby skills in this example-driven course.

Ruby 2.0

Design powerful, elegant Ruby code by mastering blocks and iterators!

Blocks are an intrinsic and powerful aspect of the language. Many of the methods in the Ruby standard library assume you have a solid understanding of blocks. And blocks are used pervasively in Ruby gems (including Ruby on Rails) and all well-designed Ruby code.

In this hands-on video course, you'll learn blocks and iterators by example with over 40 code samples!

“I've been using Ruby for a few years and bumped into blocks but I was never really getting them. Your course helped me finally wrap my head around them! Now I'm off to refactor some of my code!” Hans verschooten
“This course taught me a number of great techniques… Even more valuable are the use cases, which set the course apart from many other programs that teach the how, but not the why.” Randy Burgess

Learn By Example and Exercise

Explore blocks used in a variety of real-world situations.

In this course we walk through over 40 in-depth examples so you build a deep understanding of both how to use blocks and also when and why to use them.

Block Basics

To be an effective Ruby programmer, you need to be very proficient with blocks. We'll start with the basics and work up to advanced block usage. In the end you'll be able to read and write any code that uses blocks.

Custom Iterators

Ruby's built-in iterator methods—each, times, and so on— aren't "magical" once you understand how to yield to a block. Learn how to design your own classes and APIs using custom iterators like the ones you use every day.

When, Why, and How to Use Blocks

Once you're comfortable with the syntax, the next level is to understand when and why to use blocks. And the best way to do that is by looking at lots of good examples. You'll learn how to effectively apply blocks in a variety of situations to make your code more expressive, concise, and flexible.

Design Techniques & Patterns

Blocks offer a different (powerful!) style of programming that should influence the design of your code. Throughout the course we'll examine many use cases where blocks elegantly solve common problems. Discover how to use blocks to remove unnecessary code, manage resources, and more! You'll be able to immediately apply these techniques and patterns to your own code.

Master the Enumerable Module

The methods in the Enumerable module—select, reject, map, reduce, and friends—are particularly great examples of the power of blocks. And once you graps blocks, the secret to all these methods is suddenly revealed. Master the Enumerable methods and you'll be a more efficient Ruby programmer!

Real-World, Practical Examples

No dry definitions or boring theory here. This course is loaded with good examples of blocks and iterators used in various scenarios. By seeing recurring patterns in different contexts, you'll come away with a clear understanding of not just how blocks work but, equally important, when and where to use them.

This Course
Mastering Ruby Blocks & Iterators 15 Videos • 2 Hours
$30
Mastery Bundle
Ruby and Rails Master Package: All 3 Ruby and Rails Courses All 3 Courses = Best Deal!
$394 $330 on sale

Here's What You Get:

High-Quality Videos

Streamable and downloadable, DRM-free videos on any device. English subtitles on each video.

Workbook

Apply what you learned in the videos through a series of exercises to build a slightly different program on your own computer.

Cheat Sheets

PDF cheat sheets that summarize the syntax, concepts, conventions, and shortcuts taught throughout the course.

Source Code

Over 40 code examples that illustrate how blocks are used effectively in a variety of use cases.

Support Mailing List

Post questions, get answers, and connect with other students who are taking the course.

Instant, Never-Expiring Access

No monthly subscription or time limit. Start when you want and repeat as often as you like!

For Beginner To Intermediate Ruby Programmers

Quickly transform into an empowered Ruby programmer!

Does using blocks feel mysterious?

In this course we walk through over 40 code examples that illustrate how blocks work so you can use them with more confidence.

Ready to level up?

With a deeper understanding of the when, how, and why of blocks, you'll be well on your way to mastering Ruby.

Want to design your code the Ruby way?

You'll learn design techniques, patterns, and idioms that you can then apply to your own code.

New to Ruby?

If you're brand new to the Ruby programming language we strongly recommend taking our Ruby course before taking this course.

We aim for 100% satisfied developers, so if this course turns out not to be a good fit for you, we'll gladly issue you a 100% refund.

Created with 💛 by Mike and Nicole Clark

Hi, we'd be delighted to have you along as we create stuff in the Studio!

We made this course because blocks and iterators are knitted into the very fabric of Ruby. Once you've mastered them, you've mastered Ruby. This is the course we desperately needed in our early days of Ruby (over 15 years ago!). We could have benefited from lots of examples, and so this course delivers exactly that. We hope you enjoy it!

Join others who have mastered Ruby!

Here's what some of them have to say…

“This course, as well as all the other Pragmatic Studio courses, approaches perfection! The tone is pleasant, the explanations are clear, the exercises are interesting, and the course is ideal for practicing and learning.” Bruno Dusausoy
“I really thought I had a good grasp on Ruby blocks, but I was mistaken. I am NOW quite confident about my understanding of blocks, and mastery over them. I suddenly feel newly empowered!Thom Parkin
“I highly recommend this for anyone, not just those who want to learn Ruby, but also to those who want to learn good software design in general.Elliot Kleiman
“I really liked the step-by-step explanations about how blocks work and how the internal methods are implemented. Also, super explanatory animations!Haris Dimitriou
I have a much better understanding and can confidently implement blocks using yield. Also, the Execute Around pattern you teach is magnificent, and since finishing the class I'm writing methods with fresh eyes!” Dan Wagner
I loved the real-life examples, rather than contrived code, in this course. These examples made it easy to relate the techniques to my own code.” Steve Willis