Skip to content

Instantly share code, notes, and snippets.

@leobessa
Created May 31, 2011 21:02
Show Gist options
  • Save leobessa/1001280 to your computer and use it in GitHub Desktop.
Save leobessa/1001280 to your computer and use it in GitHub Desktop.
module RaiseExit
def raise(msg_or_exc, msg=msg_or_exc, trace=caller)
warn msg.to_s
exit!
end
end
class Object
include RaiseExit
end
begin
raise "TooLazyToWork"
rescue
puts "executing rescue"
ensure
puts "executing ensure"
end
@leobessa
Copy link
Author

Considering the ruby method lookup

instead of including RaiseExit in the Kernel module...

module Kernel 
  include RaiseExit
end

it should be included in the Object class.

class Object
  include RaiseExit
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment