A Deeper Look at Ruby's Enumerable - Part 1 (each_cons, all?, none?, any?)
Have you ever needed to load a VERY large file in ruby? No I don’t mean your 500 line rails model. I mean a several gig binary or text file.
Try it. Watch your machine become unresponsive. Cry a little inside. Then reach for enumerable.
Ruby’s Enumerable module gives you a way of iterating over collections in a lazy manner, loading only what you need, when you need it. But it gives us so much more than that.
Today I am going to walk you through a couple of highly useful methods from Enumerable that has come up in a few coding challenges I have done over the years.
Post a comment