A comprehensive rebuild on basic Enumerable methods in Ruby for a better understanding in block passing, enumerator and classes and regular expressions as arguments.
- #each as #my_each
- #each_with_index as #my_each_with_index
- #select as #my_select
- #all? as #my_all?
- #any? as #my_any?
- #none? as #my_none?
- #count as #my_count
- #map as #my_map
- #inject as #my_inject
each of them can be used as default Enumerable methods working the exact same way
- #my_each with no block passed returns an enumerator
- #my_each with block passed do a loop routine
- #my_each_with_index with no block passed returns an enumerator
- #my_each_with_index with block passed counts index elements
- #my_select with no block passed returns an enumerator
- #my_each with block passed returns an Array
- #my_each with block passed returns an even number array
- #my_each with block passed fails an .odd? on array
- #my_all? with no block passed returns true
- #my_all? with block passed returns true
- #my_all? with block passed returns true
- #my_all? with block passed returns false
- #my_all? with regexp passed returns false
- #my_all? with class passed returns true
- #my_any? with no block passed returns true
- #my_any? with block passed returns true
- #my_any? with block passed returns false
- #my_any? with block passed returns false
- #my_any? with regexp passed returns not true
- #my_any? with class passed returns true
- #my_none? with no block passed returns false
- #my_none? with block passed returns false
- #my_none? with block passed returns true
- #my_none? with block passed returns not true
- #my_none? with regexp passed returns true
- #my_none? with class passed returns true
- #my_count with no block passed returns number of elements in an array
- #my_count with block passed returns number of .even? elements
- #my_count with block passed returns number of .odd? elements
- #my_count with block passed returns number of x > 5 elements
- #my_count with argument passed returns number of element repetition
- #my_map with no block passed returns an Enumerator
- #my_map with block passed returns a modified array
- #my_map with block passed returns a parsed array
- #my_inject with block passed returns an array sum
- #my_inject with block passed returns a parsed array
Check out the project specification here: https://www.theodinproject.com/courses/ruby-programming/lessons/advanced-building-blocks#additional-resources
Testing project specification can be found at : https://www.theodinproject.com/courses/ruby-programming/lessons/testing-your-ruby-code
Coded by Eduardo 'Usagi' Bonilla: GitHub Testing by Ko Nyan: GitHub