GithubHelp home page GithubHelp logo

mauricio-mds / custom_enumerable_project Goto Github PK

View Code? Open in Web Editor NEW

This project forked from theodinproject/custom_enumerable_project

0.0 0.0 0.0 29 KB

Enumerable Ruby exercises from The Odin Project

License: MIT License

Ruby 100.00%

custom_enumerable_project's Introduction

Custom Enumerable Project

This repository complements the Custom Enumerables Project in the Ruby Course for The Odin Project. The goal of this project is to reimplement common methods used frequently through the enumerables module with objects like arrays and hashes. This project will also familiarize you with how to work with blocks and procs. Some starter code and specs are provided to validate the correctness of your solutions.

Installation

First, clone this repository with

git clone [email protected]:TheOdinProject/custom_enumerable_project.git

Then, navigate into the folder through your command line with

cd custom_enumerable_project

and install the dependencies using the command

bundle install

Getting Started

You will add new methods to the Enumerable module in lib/my_enumerables.rb. Before you implement a method, go to the corresponding spec file and watch the test fail by running

bundle exec rspec <spec_file>

You can find the associated spec file in the methods section. Then, add the method to the enumerable module. Run the tests again using the same command until they pass.

Example

As an example, before you start implementing the my_each method, run

bundle exec rspec spec/my_each_spec.rb

to see that the test fails as expected.

Once you implement it, like so:

# lib/my_enumerables.rb

class Array
  def my_each
    # Complete code
  end
end

run the command

bundle exec rspec spec/my_each_spec.rb

again to see if your code is correct or not.

Methods

The following table has the methods you will need to implement along with their associated specs, as outlined in the project instructions. The methods in the Enumerable module only need to work with Arrays, but you can challenge yourself and try to make them work for Hashes as well.

Method Spec File Notes
Array#my_each spec/my_each_spec.rb You will define my_each on the Array class in lib/my_enumerables.rb
Enumerable#my_each_with_index spec/my_each_with_index_spec.rb
Enumerable#my_select spec/my_select_spec.rb
Enumerable#my_all? spec/my_all_spec.rb
Enumerable#my_any? spec/my_any_spec.rb
Enumerable#my_none? spec/my_none_spec.rb
Enumerable#my_count spec/my_count_spec.rb
Enumerable#my_map spec/my_map_spec.rb
Enumerable#my_inject spec/my_inject_spec.rb

custom_enumerable_project's People

Contributors

rankoliang avatar mauricio-mds avatar kevinmulhern avatar chargrilledchook avatar forthoney avatar rlmoser99 avatar couchoftomato avatar digitalknight0 avatar themetar avatar scheals avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.