るりまサーチ

最速Rubyリファレンスマニュアル検索!
11件ヒット [1-11件を表示] (0.128秒)
トップページ > クエリ:i[x] > クエリ:j[x] > クエリ:==[x] > クエリ:instance[x] > クラス:Object[x]

別のキーワード

  1. encoding windows_31j
  2. _builtin windows_31j
  3. _builtin cswindows31j
  4. encoding cswindows31j
  5. json j

ライブラリ

検索結果

Object#===(other) -> bool (15219.0)

case 式で使用されるメソッドです。d:spec/control#case も参照してください。

... Object#== を呼び出します。

when 節の式をレシーバーとして === を呼び出すことに注意してください。

また Enumerable#grep でも使用されます。

@param other 比較するオブジェクトです。

//emlist[][ruby]{
age = 12
# (0..2).===(12), (3..6).===(12...
...aby"
when 3 .. 6
"little child"
when 7 .. 12
"child"
when 13 .. 18
"youth"
else
"adult"
end

puts result #=> "child"

def check arg
case arg
when /ruby(?!\s*on\s*rails)/i
"hit! #{arg}"
when String
"Instance of String class. But don't hit."
else
"unknown"...
...end
end

puts check([]) #=> unknown
puts check("mash-up in Ruby on Rails") #=> instance of String class. But not hit...
puts check("<Ruby's world>") #=> hit! <Ruby's world>
//}

@see Object#==, Range#===, Module#===, Regexp#===, Enumerable#grep...