このマニュアルは既にメンテナンスが終了したバージョンの Ruby を対象としています。 最新版のマニュアルへ

Ruby 2.7.0 リファレンスマニュアル

instance method Exception#inspect

inspect -> String[permalink][rdoc]

self のクラス名と message を文字列にして返します。


begin
  raise "exception"
rescue
  p $!.inspect # => "#<RuntimeError: exception>"
end