]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/commitdiff
Memory optimizations in plugin management (useful on rescans)
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Tue, 23 Jan 2007 16:19:14 +0000 (16:19 +0000)
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Tue, 23 Jan 2007 16:19:14 +0000 (16:19 +0000)
lib/rbot/plugins.rb

index 66a7d84294778572ef7f3f2a53462cef379a279a..564495e0c5d89beaba2566e68ce59cfb2974b335 100644 (file)
@@ -252,19 +252,28 @@ module Plugins
     attr_reader :botmodules
 
     def initialize
-      bot_associate(nil)
-
-      @dirs = []
-    end
-
-    # Reset lists of botmodules
-    def reset_botmodule_lists
       @botmodules = {
         :CoreBotModule => [],
         :Plugin => []
       }
+
       @names_hash = Hash.new
       @commandmappers = Hash.new
+
+      @dirs = []
+
+      @failed = Array.new
+      @ignored = Array.new
+
+      bot_associate(nil)
+    end
+
+    # Reset lists of botmodules
+    def reset_botmodule_lists
+      @botmodules[:CoreBotModule].clear
+      @botmodules[:Plugin].clear
+      @names_hash.clear
+      @commandmappers.clear
     end
 
     # Associate with bot _bot_
@@ -380,8 +389,8 @@ module Plugins
 
     # load plugins from pre-assigned list of directories
     def scan
-      @failed = Array.new
-      @ignored = Array.new
+      @failed.clear
+      @ignored.clear
       processed = Hash.new
 
       @bot.config['plugins.blacklist'].each { |p|