Project developed with Ruby. The objective is to rebuild commonly used iterators methods.
Explore the docs »
View Demo
·
Report Bug
·
Request Feature
(Click on the image to play with the code! See instructions in Usage)
In this project I rebuild the following iterator methods used in the enumerator module:
- #each -> #my_each
- #each_with_index -> #my_each_with_index
- #select -> #my_select
- #all? -> #my_all?
- #any? -> #my_any?
- #none? -> #my_none?
- #count -> #my_count
- #map -> #my_map
- #inject -> #my_inject
- Test #my_inject by creating a method called #multiply_els which multiplies all the elements of the array together by using #my_inject, e.g. multiply_els([2,4,5]) #=> 40
- Modify #my_map method to take a proc instead.
- Modify #my_map method to take either a proc or a block. If both are given, preference to the proc.
The project was developed using the following technologies:
Click on the image at the top or in the following link,
In the left panel, select "my_methods.rb"
You can try any method in the About the Project section. A fast way to do this is by typing at the end of the document (line 131) in the following format: puts argument.this_method {provide_block_if required}
- for example
puts [10, 19, 18].none? { |num| num>4}
Click on the console and type ruby my_methods.rb
and hit enter
You will get the result at the end of the console
For the test, click on the image at the top or in the following link,
- Click on the console and type
gem install rspec
then press enter to begin the instalation process - Once the process is done, type
rspec
and press enter to see the 67 test for this game - You can see the test files by clicking on the left panel spec/my_methods_spec.rb
See the open issues for a list of proposed features (and known issues).
Project Link: https://github.com/kitpao/my_enumerable_methods
Kitzia Paola Vidal Marroquin - Github user: kitpao