From d73581c3424176cd83e58e8e8fdceea528b172f7 Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Sun, 2 Sep 2007 09:30:06 +0000 Subject: plugins.rb: minor #delegate() optimization --- lib/rbot/plugins.rb | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) (limited to 'lib/rbot/plugins.rb') diff --git a/lib/rbot/plugins.rb b/lib/rbot/plugins.rb index 061c6a73..e1cf9c9f 100644 --- a/lib/rbot/plugins.rb +++ b/lib/rbot/plugins.rb @@ -626,19 +626,17 @@ module Plugins def delegate(method, *args) # debug "Delegating #{method.inspect}" ret = Array.new - [core_modules, plugins].each { |pl| - pl.each {|p| - if(p.respond_to? method) - begin - # debug "#{p.botmodule_class} #{p.name} responds" - ret.push p.send(method, *args) - rescue Exception => err - raise if err.kind_of?(SystemExit) - error report_error("#{p.botmodule_class} #{p.name} #{method}() failed:", err) - raise if err.kind_of?(BDB::Fatal) - end + (core_modules + plugins).each { |p| + if(p.respond_to? method) + begin + # debug "#{p.botmodule_class} #{p.name} responds" + ret.push p.send(method, *args) + rescue Exception => err + raise if err.kind_of?(SystemExit) + error report_error("#{p.botmodule_class} #{p.name} #{method}() failed:", err) + raise if err.kind_of?(BDB::Fatal) end - } + end } return ret # debug "Finished delegating #{method.inspect}" -- cgit v1.2.3