]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/commitdiff
plugins.rb: minor #delegate() optimization
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Sun, 2 Sep 2007 09:30:06 +0000 (09:30 +0000)
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Sun, 2 Sep 2007 09:30:06 +0000 (09:30 +0000)
lib/rbot/plugins.rb

index 061c6a73b3b7d4d5ce033d65cb0474dd11b1022f..e1cf9c9fb23915979af78cfdecad1d6527851d45 100644 (file)
@@ -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}"