Method wrapper for ruby
Ruby
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
lib
test
.document
.gitignore
Gemfile
LICENSE.txt
README.rdoc
Rakefile
VERSION
wrap_method.gemspec

README.rdoc

wrap_method

Useful for callbacks, benchmarking, profiling, code graphs.

Example

require 'rubygems'
require 'wrap_method'

class Module
  def make_cool(method_name)
    wrap_method(method_name) do |org_method, args, block|
      puts 'Pssst!'
      result = org_method.call(*args, &block)
      puts '     Sexy girl!!!'
      result
    end
  end
end

class Person
  def greet
    puts '  Hey there..'
  end
end

Person.make_cool :greet
Person.new.greet

Output

Pssst!
  Hey there..
     Sexy girl!!!

Copyright

I am not the author, am just providing people with the gem. original code and author can be found here:

www.erikveen.dds.nl/monitorfunctions/index.html