🔥 Get early access to the new Phoenix LiveView course!

Mastering Ruby
Blocks & Iterators

Ruby 2.7

Design powerful, elegant Ruby code by mastering blocks and iterators in this example-driven course.

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 real-world examples!

Hans verschooten
“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
Randy Burgess
“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 40+ real-world examples.

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.

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.

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 grasp blocks, the secret to all these methods is suddenly revealed. Master the Enumerable methods and you'll be a more efficient Ruby programmer!

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.

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.

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
$49 $30
Pro Bundle
Ruby and Rails Pro Bundle: All 3 Ruby and Rails Courses All 3 Courses = Best Deal!
$394 $299

Questions? Email Mike and Nicole.

There's no risk. This course is 100% guaranteed for an entire 30 days. If you find it's not a good fit for you, we'll be happy to refund your money.

Live in a country where our courses are very expensive? We offer purchasing power parity discounts.

Here's What You Get:

High-Quality Videos

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


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

Source Code

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

Instant and Forever 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.

Created with 💛 by
Mike and Nicole Clark

Mike and Nicole

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!

More about us →

Join others who have mastered Ruby!

Here's what some of them have to say…

Bruno Dusausoy
“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
Thom Parkin
“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
Elliot Kleiman
“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
Haris Dimitriou
“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
Dan Wagner
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
Steve Willis
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