Uberhook
The Uberhook gem allows you to define before
and after
hooks for your Ruby classes.
Installation
$ gem install uberhook
Or add the following line to your application's Gemfile and run $ bundle
afterwards.
gem 'uberhook'
Usage
require 'uberhook'
class Car
extend Uberhook
before :drive do
p 'start engine'
end
after :drive do
p 'turn radio on'
end
def drive
p 'drive'
end
end
beatle = Car.new
beatle.drive
# Output:
# start engine
# drive
# turn radio on