diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2007-09-02 09:30:06 +0000 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2007-09-02 09:30:06 +0000 |
commit | d73581c3424176cd83e58e8e8fdceea528b172f7 (patch) | |
tree | 3c9044f6d37f05dc5436ce50cfc83098ef63fca1 /lib/rbot/plugins.rb | |
parent | b0b47f17ec0bea2cacde2aada54fab6273985f34 (diff) |
plugins.rb: minor #delegate() optimization
Diffstat (limited to 'lib/rbot/plugins.rb')
-rw-r--r-- | lib/rbot/plugins.rb | 22 |
1 files changed, 10 insertions, 12 deletions
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}" |