Uberhook

The Uberhook gem allows you to define before and after hooks for your classes and models.

Installation

Add this line to your application's Gemfile:

gem 'uberhook'

And then execute:

$ bundle

Or install it yourself as:

$ gem install uberhook

Usage

require 'uberhook'

class Car
  include Uberhook

  before :drive, :start_engine

  def drive
    puts 'Now lets drive.'
  end

  def start_engine
    puts 'First start the engine.'
  end
end

beatle = Car.new
beatle.drive

# Output:
#   First start the engine.
#   And now lets drive.