Event Hook
Exception-based Event Hooks provides an Event Hooks system designed on top of Ruby‘s built-in Exception system.
def dothis2
puts 'pre'
hook :quitit
puts 'post'
end
def tryit2
begin
puts "BEFORE"
dothis2
puts "AFTER"
rescue EventHook
event :quitit do
puts "HERE"
end
end
end
tryit2
Authors
- Thomas Sawyer
Copying
Copyright (c) 2004 Thomas Sawyer
Ruby License
This module is free software. You may use, modify, and/or redistribute this software under the same terms as Ruby.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.