Add Kernel#at_exit method in mruby.
def do_at_exit(str1)
at_exit { print str1 }
end
at_exit { puts "cruel world" }
do_at_exit("goodbye ")
exit
#=> goodbye cruel worldOn your build_config.rb
MRuby::Build.new do |conf|
# by mgem
conf.gem :mgem => 'mruby-at_exit'
# by github
conf.gem :github => 'ksss/mruby-at_exit'
end