Monkey Patching in Ruby

suggest change

Introduction

Monkey Patching is a way of modifying and extending classes in Ruby. Basically, you can modify already defined classes in Ruby, adding new methods and even modifying previously defined methods.

Remarks

Monkey patching is often used to change the behavior of existing ruby code, from gems for instance.

For instance, see this gist.

It can also be used to extend existing ruby classes like Rails does with ActiveSupport, here is an example of that.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents