| Start |
|---|
| Adding Functionality You can add a method to any class in Ruby, whether it's a builtin or not. The calling object is referenced using RemarksMonkey patching, while convenient, has some pitfalls that aren't immediately obvious. Most notably, a patch like that in the example pollutes the global scope. If two modules both add Furthermore, if there's an error in a patched method, the stacktrace simply points to the patched class. This implies that there's a bug in the Lastly, because Ruby is very flexible with what containers to hold, a method that seems very straightforward when you write it has lots of undefined functionality. For instance, creating A safer alternative is refinements, available in Ruby >= 2.0. |
Read Article
https://develop.horje.com/learn/1434/reference