]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/commitdiff
* fixed incorrect loading logic which could have added entries to @aliases even when...
authorYaohan Chen <yaohan.chen@gmail.com>
Tue, 14 Aug 2007 18:02:04 +0000 (18:02 +0000)
committerYaohan Chen <yaohan.chen@gmail.com>
Tue, 14 Aug 2007 18:02:04 +0000 (18:02 +0000)
  were invalid

data/rbot/plugins/alias.rb

index 581cde1fb52643dbb9dd0f67970beb0ad21e46b6..1496755d099dd8db3d51005afb14940d737d2a8f 100644 (file)
@@ -44,15 +44,16 @@ class AliasPlugin < Plugin
     @data_file = "#{@data_path}/aliases.yaml"
     # hash of alias => command entries
     data = nil
-    @aliases = if File.exist?(@data_file) &&
-                  (data = YAML.load_file(@data_file)) &&
-                  data.respond_to?(:each_pair)
-                 data
-               else
-                 warning _("Data file is not found or corrupt, reinitializing data")
-                 Hash.new
+    aliases = if File.exist?(@data_file) &&
+                 (data = YAML.load_file(@data_file)) &&
+                 data.respond_to?(:each_pair)
+                data
+              else
+                warning _("Data file is not found or corrupt, reinitializing data")
+                Hash.new
                end
-    @aliases.each_pair do |a, c|
+    @aliases = Hash.new
+    aliases.each_pair do |a, c|
       begin
         add_alias(a, c)
       rescue AliasDefinitionError