Search code examples
rubyrubygemsmonkeypatching

Isolating monkey patches in a ruby gem?


I've noticed that a few ruby gems that I use ship with a folder named ext or core_ext which contains a set of monkey patches to the core library that is used in their code. However, when I require those gems I get those monkey patches as well.

Is it possible for gem authors or for gem users to isolate those monkey patches such that they are only visible in the Modules that the gem defines/exports?


Solution

  • It won't be possible until refinements are implemented, see Shugo Maeda's proposal.