3 ms·
Man, who down votes someone for asking a genuine question? This isn't monkey patching. Ruby's classes are open (they can be modified on the fly), so you can mo
by SlyShy 16y ago
Man, who down votes someone for asking a genuine question?
This isn't monkey patching. Ruby's classes are open (they can be modified on the fly), so you can monkey patch modules with new functionality. In a language like C, if you wanted to extend a library, you might modify it and recompile.
Ruby's module_eval and class_eval are meta-programming tools that let you programmatically add methods to classes (and lots of other stuff), this can be combined with monkey patching, if you so desire.