A big reason I love Ruby is how much work I can get done in just a few characters or lines of code, and ensuring that code is still easy to read fo...
For further actions, you may consider blocking this person and/or reporting abuse
Enumerable#lazy
probably deserves its own article. It's a great feature if you want your code to be nice to read but still somewhat performant.Ya this is the one that was new to me from the list! Would love to read an article on it alone
Great article. Thanks for sharing this knowledge 🙏
While describing the behaviour of
each_cons
, you mention the above. I think that may not be 100% accurate in all cases, as the first element of the next array is actually the second element of the previous.It just so happens to be correct for the accompanying example because the returned arrays are of size 2.
Hope that makes sense 🙂
Thanks for reading!
Good catch there 😅 I've updated the post to state that correctly, thank you for pointing it out.
Thanks for sharing. We have endless ranges at last! No more
Float::INFINITY
-ish solutions.