summaryrefslogtreecommitdiff
path: root/lib/rbot
diff options
context:
space:
mode:
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2006-08-31 15:08:04 +0000
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2006-08-31 15:08:04 +0000
commitf941450468f6d55272a18e037527f662a9e5eb82 (patch)
tree86b84f81fde9eda797f50832103630a82718d8dd /lib/rbot
parent6b4751c8b6e99dcff80cfe5e66c746cf9106dc6a (diff)
Fix messagemapper for optional arguments
Diffstat (limited to 'lib/rbot')
-rw-r--r--lib/rbot/messagemapper.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/rbot/messagemapper.rb b/lib/rbot/messagemapper.rb
index fd8c7e7d..e899770a 100644
--- a/lib/rbot/messagemapper.rb
+++ b/lib/rbot/messagemapper.rb
@@ -240,11 +240,11 @@ module Irc
raise ArgumentError, "template #{str.inspect} should be a String" unless str.kind_of?(String)
# split and convert ':xyz' to symbols
- items = str.strip.split(/\s+/).collect { |c|
+ items = str.strip.split(/\]?\s+\[?/).collect { |c|
+ # there might be extra (non-alphanumeric) stuff (e.g. punctuation) after the symbol name
if /^(:|\*)(\w+)(.*)/ =~ c
- # there might be extra (non-alphanumeric) stuff (e.g. punctuation) after the symbol name
sym = ($1 == ':' ) ? $2.intern : "*#{$2}".intern
- if $3.nil?
+ if $3.empty?
sym
else
[sym, $3]
@@ -353,7 +353,7 @@ module Irc
end
else
value = @defaults[item]
- warning "No default value for optiona #{item.inspect} specified" unless @defaults.has_key?(item)
+ warning "No default value for option #{item.inspect} specified" unless @defaults.has_key?(item)
end
options[item] = value
debug "set #{item} to #{options[item].inspect}"