Created
March 20, 2012 21:52
-
-
Save carlzulauf/2141673 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class STOP < Exception | |
def initialize(msg) | |
super | |
puts "STOP! #{msg}" | |
end | |
def time; Time.now; end | |
end | |
def Time.cant_touch_this | |
raise STOP.new("hammer time") | |
end | |
begin | |
Time.cant_touch_this | |
rescue STOP => hammer | |
puts hammer.time | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment