1

可能重复:
=== vs. == in Ruby

我根本找不到详细的文档。文档页面已损坏:

http://ruby-doc.org/core-1.9.3/String.html

正则表达式页面在两种不同的意义上使用“案例”一词(!),我不明白重点是什么:

http://www.ruby-doc.org/core-1.9.3/Regexp.html#method-i-3D-3D-3D

它在 Rails 中使用:

https://github.com/rails/rails/commit/3756a3fdfe8d339a53bf347487342f93fd9e1edb?utm_source=rubyweekly&utm_medium=email

4

1 回答 1

2

===是“大小写相等”运算符:

在 Ruby 中,三等号 (Object#===) 是“实际上与调用 #== 相同,但通常被后代覆盖以在 case 语句中提供有意义的语义”。

http://andy-payne.com/2008/09/confusion-over-triple-equals/

于 2012-04-05T12:17:43.400 回答