Skip to content
This repository has been archived by the owner on Apr 13, 2019. It is now read-only.

Commit

Permalink
support lambdas for hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
dominikh committed Mar 22, 2012
1 parent adff35b commit 5d00ee3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/cinch/plugin.rb
Expand Up @@ -292,7 +292,11 @@ def __hooks(type = nil, events = nil)
def call_hooks(type, event, instance, args)
stop = __hooks(type, event).find { |hook|
# stop after the first hook that returns false
instance.__send__(hook.method, *args) == false
if hook.method.respond_to?(:call)
instance.instance_exec(*args, &hook.method) == false
else
instance.__send__(hook.method, *args) == false
end
}

!stop
Expand Down

0 comments on commit 5d00ee3

Please sign in to comment.