Ruby 2.5.0 リファレンスマニュアル > ライブラリ一覧 > 組み込みライブラリ > UncaughtThrowErrorクラス > tag

instance method UncaughtThrowError#tag

tag -> object[permalink][rdoc]

Kernel.#throw に指定した tag を返します。

例:

def do_complicated_things
  throw :uncaught_label
end

begin
  do_complicated_things
rescue UncaughtThrowError => ex
  p ex.tag # => ":uncaught_label"
end