hi guys !
does ruby have a die method ? or is it there a method that displays a
string before exiting ?
hi guys !
does ruby have a die method ? or is it there a method that displays a
string before exiting ?
On Tue, Sep 2, 2008 at 7:43 AM, Lex W. [email protected] wrote:
hi guys !
does ruby have a die method ? or is it there a method that displays a
string before exiting ?
Kernel#at_exit
You can register handlers that get executed when the program exits.
at_exit {puts “Dying”}
puts “In the program”
You can build your own method to print, such as:
module Kernel
def print_at_exit str
at_exit {print str}
end
end
print_at_exit “goodbye”
Jesus.
From: “Lex W.” [email protected]
does ruby have a die method ? or is it there a method that displays a
string before exiting ?
abort “bye…”
Hope this helps,
Bill
Bill K. wrote:
From: “Lex W.” [email protected]
does ruby have a die method ? or is it there a method that displays a
string before exiting ?abort “bye…”
Hope this helps,
Bill
Thanks Bill , just what I was looking for .
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs