Save 36% for Black Friday! Learn more

Want more GoRails?

GoRails is packed full with 770 lessons just like this one.

Sign up to get full access or log in to your account and sit back.

Refactoring with Enumerable partition

June 10, 2024

Track your progress

Sign in to track your progress and access subscription-only lessons.

Log In

Your Teacher

Collin Jilbert

Ruby on Rails Developer | Lover of Music | Skateboarder | Proud Papa | Co-editor @therubyradar | Launched @fleur_de_ruby

About This Episode

In this lesson, we will look at how to clean up code that iterates over a collection twice to separate the elements out to only doing so once while achieving the same result by leveraging the partition method from Ruby's Enumerable module.