在红宝石中分离出猴子斑块?
我注意到我使用的一些 ruby gem 带有一个名为 ext
或 core_ext
的文件夹,其中包含一组针对其核心库的猴子补丁。代码。然而,当我需要
这些宝石时,我也会得到那些猴子补丁。
gem 作者或 gem 用户是否可以隔离这些猴子补丁,以便它们仅在 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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在实施改进之前这是不可能的,请参阅Shugo Maeda 的提案。
It won't be possible until refinements are implemented, see Shugo Maeda's proposal.