るりまサーチ

最速Rubyリファレンスマニュアル検索!
12件ヒット [1-12件を表示] (0.152秒)
トップページ > 種類:インスタンスメソッド[x] > クエリ:p[x] > クエリ:map[x] > クラス:Exception[x]

別のキーワード

  1. openssl p
  2. openssl p=
  3. fileutils mkdir_p
  4. dh p
  5. dsa p

ライブラリ

検索結果

Exception#==(other) -> bool (3044.0)

自身と指定された other のクラスが同じであり、 message と backtrace が == メソッドで比較して 等しい場合に true を返します。そうでない場合に false を返します。

...そうでない場合に false を返します。

@param other 自身と比較したいオブジェクトを指定します。
自身と異なるクラスのオブジェクトを指定した場合は
Exception
#exception を実行して変換を試みます。

//emlist[例...
...th} is not long month"
end

def get_exception
return begin
yield
rescue => e
e
end
end

results = [2, 2, 4].map { |e | get_exception { check_long_month(e) } }
p
results.map { |e| e.class }
# => [RuntimeError, RuntimeError, RuntimeError]
p
results.map { |e| e.message }
# => ["2 is not l...
...ong month", "2 is not long month", "4 is not long month"]

# class, message, backtrace が同一のため true になる
p
results[0] == results[1] # => true

# class, backtrace が同一だが、message がことなるため false になる
p
results[0] == results[2] # => false
//}...