diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2006-07-25 01:18:02 +0000 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2006-07-25 01:18:02 +0000 |
commit | bba93c30e8892bd475427ea211d48f59e4a641aa (patch) | |
tree | f1b4e279d7fa62b1427483630f803493c9227fce /lib | |
parent | 0a9b8950fd09f8b815d9f4c491eaadba5f64707e (diff) |
When verifying uniqueness of plugin map parameters names, check for :param vs *param too
Diffstat (limited to 'lib')
-rw-r--r-- | lib/rbot/messagemapper.rb | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/rbot/messagemapper.rb b/lib/rbot/messagemapper.rb index 5c3ddc05..1682e902 100644 --- a/lib/rbot/messagemapper.rb +++ b/lib/rbot/messagemapper.rb @@ -177,8 +177,11 @@ module Irc # Verify uniqueness of each component. @items.inject({}) do |seen, item| if item.kind_of? Symbol - raise ArgumentError, "Illegal template -- duplicate item #{item}\n #{str.inspect}" if seen.key? item - seen[item] = true + # We must remove the initial * when present, + # because the parameters hash will intern both :item and *item as :item + it = item.to_s.sub(/^\*/,"").intern + raise ArgumentError, "Illegal template -- duplicate item #{it} in #{str.inspect}" if seen.key? it + seen[it] = true end seen end |