るりまサーチ

最速Rubyリファレンスマニュアル検索!
24件ヒット [1-24件を表示] (0.011秒)
トップページ > クエリ:ref[x] > モジュール:Kernel[x] > クエリ:exit[x]

別のキーワード

  1. fiddle ref
  2. pointer ref
  3. entity ref
  4. _builtin _id2ref
  5. rexml/document ref

ライブラリ

検索結果

Kernel.#exit(status = true) -> () (18150.0)

Rubyプログラムの実行を終了します。status として整 数が与えられた場合、その値を Ruby コマンドの終了ステータスとします。 デフォルトの終了ステータスは 0(正常終了)です。

...false の場合 1 を引数に指定したとみなされます。この値はCレベルの定数
EXIT
_SUCCESS、EXIT_FAILURE の値なので、正確には環境依存です。

exit
は例外 SystemExit を発生させ
ることによってプログラムの実行を終了させますので、
...
.....'
exit

rescue SystemExit => err
puts "end1 with #{err.inspect}"
end

begin
puts 'start2...'
exit

ensure
puts 'end2...'
end
puts 'end' #実行されない

#=> start
# start1...
# end1 with #<SystemExit: exit>
# start2...
# end2...
#終了ステータス:0
//}

@see Kernel.#exit!,...

Kernel.#at_exit { ... } -> Proc (6168.0)

与えられたブロックをインタプリタ終了時に実行します。

...与えられたブロックをインタプリタ終了時に実行します。

at_exitがメソッドである点を除けば、END ブロックによる終了
処理の登録と同等です。登録した処理を取り消すことはできません。
spec/terminateも参照してください。...
...Proc オブジェクトで返します。

//emlist[例][ruby]{
3.times do |i|
at_exit{puts "at_exit#{i}"}
end
END{puts "END"}
at_exit{puts "at_exit"}
puts "main_end"

#=> main_end
# at_exit
# END
# at_exit2
# at_exit1
# at_exit0
//}

@see d:spec/control#END,Kernel.#exit!,Kernel.#fork...