jindai1783 / Practice_Monkey_Patching

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Practice Monkey Patching

Introduction

This repository is created for practising monkey-patching in Ruby. It is Makers Academy's Inject Challenge.

Tasks

  • 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.
  • Submit pull request with your solution

About


Languages

Language:Ruby 100.0%