DEV Community

Discussion on: Level Up Your Ruby Skillz: Working With Arrays

Collapse
 
molly profile image
Molly Struve (she/her)

YES! One of my favorite ruby methods currently is to_enum so you can use all these convenience methods with your own.

I originally had this post titled "Level Up Your Ruby Skillz: Working with Enumerators" but wanted to make it very approachable to new devs learning Ruby and figured starting with straight Arrays would be better.

Thread Thread
 
tadman profile image
Scott Tadman • Edited

I didn't know about the buddy method enum_for which also looks super handy.

Everything in Ruby is an object, but maybe we should also say that everything, with the right attitude (or method call!), can be an Enumerator, too.