如何在 Ruby 1.9 中比较两个文件?
在 Ruby 1.8 中,我会从“ftools”调用 File.compare() “库可以轻松比较两个文件的内容。
然而,在 Ruby 1.9 中,“ftools”被“fileutils”取代,后者没有“compare”方法。等效的调用是什么?
In Ruby 1.8, I would call File.compare() from the "ftools" library to easily compare the contents of two files.
However, in Ruby 1.9, "ftools" is replaced by "fileutils", which doesn't have a "compare" method. What's the equivalent call?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
啊,该方法已重命名为 compare_file。
还有一个别名“cmp ”在两个版本中。
Ahh, the method has been renamed to compare_file in FileUtils.
There's also an alias of "cmp" in both versions.
老问题,但我刚从谷歌来到这里。
identical?
适用于那些像我一样喜欢这种编码风格的人。Old question, but I just got here from google.
identical?
is available for those who like me prefer that coding style.