Sha256: aeecd1171362a0aed466b57ab24ae831013f9305798c3062594d2ceb5be6fdd5
Contents?: true
Size: 729 Bytes
Versions: 3
Compression:
Stored size: 729 Bytes
Contents
module Methadone module ExitNow def self.included(k) k.extend(self) end # Call this to exit the program immediately # with the given error code and message. # # +exit_code+:: exit status you'd like to exit with # +message+:: message to display to the user explaining the problem # # Also can be used without an exit code like so: # # exit_now!("Oh noes!") # # In this case, it's equivalent to <code>exit_now!(1,"Oh noes!")</code>. def exit_now!(exit_code,message=nil) if exit_code.kind_of?(String) && message.nil? raise Methadone::Error.new(1,exit_code) else raise Methadone::Error.new(exit_code,message) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
methadone-1.0.0.rc5 | lib/methadone/exit_now.rb |
methadone-1.0.0.rc4 | lib/methadone/exit_now.rb |
methadone-1.0.0.rc3 | lib/methadone/exit_now.rb |