るりまサーチ (Ruby 2.3.0)

最速Rubyリファレンスマニュアル検索!
1件ヒット [1-1件を表示] (0.062秒)
トップページ > クラス:String[x] > バージョン:2.3.0[x] > クエリ:_builtin[x] > クエリ:new[x] > クエリ:===[x]

別のキーワード

  1. _builtin new
  2. _builtin inspect
  3. _builtin []
  4. _builtin to_s
  5. _builtin each

ライブラリ

検索結果

String#===(other) -> bool (69322.0)

other が文字列の場合、String#eql? と同様に文字列の内容を比較します。

...other が文字列の場合、String#eql? と同様に文字列の内容を比較します。

other が文字列でない場合、
other.to_str が定義されていれば
other == self の結果を返します。(ただし、 other.to_str は実行されません。)
そうでなければ false...
...st[例][ruby]{
string
like = Object.new

def stringlike.==(other)
"string" == other
end

p "string".eql?(stringlike) #=> false
p "string" == stringlike #=> false

def stringlike.to_str
raise
end

p "string".eql?(stringlike) #=> false
p "string" == stringlike #=> true
//}

@see String#eql?...