概要
Kernel#at_exit
詳細
Ruby プログラムをエラーメッセージ付きで終了します。終了ステータスは 1 固定です。
サンプルコード
# encoding: utf-8 require 'pp' puts 'before exit1' at_exit {puts "at exit"} puts 'before exit2'
出力
before exit1 before exit2 at exit
Kernel#at_exit
Ruby プログラムをエラーメッセージ付きで終了します。終了ステータスは 1 固定です。
# encoding: utf-8 require 'pp' puts 'before exit1' at_exit {puts "at exit"} puts 'before exit2'
before exit1 before exit2 at exit