/inject-challenge

Rewrite the Ruby Inject Method

Primary LanguageRuby

Inject Challenge (Rubyist Badge)

Instructions

  • Challenge time: Friday, the entire day + the weekend if you need it
  • Feel free to use google, your notes, books, etc but work on your own
  • You must submit a pull request to this repo with your challenge solution by 9am Monday morning

Task

  • Fill out your learning plan self review for the week: https://github.com/makersacademy/learning_plan
  • Fork this repo
  • Ensure you have the 'bundle' gem by running the command 'gem install bundle'. Then run the command 'bundle' in the project directory to ensure you have all the gems you need for this.
  • Reopen the Array class or subclass it.
  • Rewrite the inject method. Write a test for it first. Don't worry about returning an enumerator, assume a block is always given
  • Name your method differently (that is, not inject() or subclass Array) because rspec uses inject() internally, so the tests will fail with weird messages unless your implementation of inject is perfect.
  • If you would like a challenge, rewrite inject using two approaches: using iterators and using recursion but it’s not required to pass. TBC.
  • Submit pull request with your solution

Build Status Coverage Status