What is 'Monkey Patching,' and what are the safer alternatives provided by modern Ruby?
Last updated
Monkey patching reopens an existing class to add or change methods at runtime. The change is global and can collide with other gems or future versions.
Refinements (
refine+using) scope a change lexically to where it's activated.A module with
prependwraps a method and callssuperinstead of overwriting it. Composition (wrapping the object in your own class) avoids altering the original at all.
- https://www.turing.com/interview-questions/ruby
- https://www.youtube.com/watch?v=lkunzd5uDrw
- https://blog.jacobvosmaer.nl/0004-ruby-scheduler-interaction/
- https://wohotech.in/coding/top-java-interview-questions
- https://jetthoughts.com/blog/ruby-3-4-yjit-performance-guide/
- https://speed.ruby-lang.org/
- https://flexiple.com/python/interview-questions