ubercj / custom-enumerables

Recreating Enumerable methods in Ruby using yield and #call

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Custom Enumerables

This is a project from the Ruby module of The Odin Project's full-stack web development curriculum. Check out the assignment here.

The goal here was to solidify my understanding of Blocks, Procs, and Lambdas as well as calling yield and #call by recreating from scratch some fundamental Enumerable methods in Ruby. For example, #my_map should function identically to #map. The custom functions are added to the Enumerable module.

The assignment suggests testing the custom enumerable methods by comparing their output in the console vs the output of the real methods. I decided to take this opportunity to brush up on my Rspec skills and wrote a series of tests for each method in addition to comparing output in the console. I found that writing the tests actually really made me have to understand the code I was writing on a deeper than if I had just used the console to compare.

Overall, I thought this was a really brilliant assignment, and I feel like a master of Blocks, Procs, and Lambdas now!

About

Recreating Enumerable methods in Ruby using yield and #call


Languages

Language:Ruby 100.0%