Mastering Ruby Blocks & Iterators
Level-up your Ruby skills and improve the design of your code by mastering Ruby blocks and iterators in this example-driven, hands-on video course.
Design powerful, elegant Ruby code!
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 Rails) and all well-designed Ruby code. If you're not using blocks then you're probably doing it wrong. This course is your path to mastery!
“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 With Over 40 Code Samples
Each in-depth example illustrates how blocks are used effectively in a variety of real-world situations. You'll become a more effective all-around Ruby programmer and have a deeper understanding of both the how and the why.
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.
- 1. Introduction and Setup
- 2. Block Basics
- 3. Each
- 4. Enumerable
- 5. Yielding
- 6. Custom Iterators
- 7. Use Cases: Execute Around
- 8. Use Cases: Toggle Around
- 9. Use Cases: Block Initializer
- 10. Use Cases: Manage Resources
- 11. Wrap Up
15 Videos • 2 Hours
3-Course Master Package
For Beginner To Intermediate Ruby Programmers
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.
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.
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.
New to Ruby? If you're brand new to the Ruby programming language we strongly recommend taking our Ruby Programming 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 by Mike and Nicole
Hi, we're real people just trying to share our passion for creating stuff!
Hey, it's Mike here. This is the course I wish I would have had in my early days of Ruby (over 10 years ago!). We distilled everything I've learned down into this course to save you time and quickly transform you into an empowered Ruby developer!
Together Nicole and I own and run The Pragmatic Studio. We'd love to have you join us in the Studio for this great course! Find out more about us…
Join others on the path to Ruby mastery!
“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 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 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 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