修补红宝石宝石

发布于 2024-07-30 13:17:21 字数 75 浏览 3 评论 0原文

在 Rails 应用程序中对 Ruby gem 应用简单补丁的最佳方法是什么?

是否可以保持原始 gem 代码不变?

What is the best way to apply a simple patch to a Ruby gem in a Rails app?

Is it possible to keep the original gem code untouched?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

风情万种。 2024-08-06 13:17:21

是的,这是可能的。 只需打开该类,为有问题的方法指定别名,并提供您自己的实现即可。 此页面显示了一个示例。

您可以从任何类中打开该类,前提是您添加了必要的包含内容。 从物理上讲,原始代码将保持不变。

Yes, it's possible. Just open the class, alias the method that has problems, and provide your own implementation of it. This page shows an example of this.

You can open that class from any class, provided you added the necessary includes. Physically, the original code will remain unchanged.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文