Skip to content

Instantly share code, notes, and snippets.

@maiha
Created January 12, 2010 19:14
Show Gist options
  • Save maiha/275506 to your computer and use it in GitHub Desktop.
Save maiha/275506 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'extlib'
class Foo
include Extlib::Hook
def foo(arg)
p [:foo, arg]
end
before(:foo) do |arg|
p [:before, arg]
end
after(:foo) do |arg|
p [:after, arg]
end
end
Foo.new.foo(1)
__END__
[:before, 1]
[:foo, 1]
test.rb:21: warning: multiple values for a block parameter (2 for 1)
from /usr/lib/ruby/gems/1.8/gems/extlib-0.9.14/lib/extlib/hook.rb:253
[:after, [nil, 1]]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment