aboutsummaryrefslogtreecommitdiff
path: root/dinobot.rb
diff options
context:
space:
mode:
authorDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2014-04-21 14:17:44 -0700
committerDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2014-04-21 14:17:44 -0700
commited04bd3c0fff100f40ed45d300fcb152723226ef (patch)
treebe80f6bc8370126e899a7b53be6fa319a3b1c2af /dinobot.rb
parent8fd8c27562184a18000d32d96921fbb0ca8045be (diff)
downloaddinobot-ed04bd3c0fff100f40ed45d300fcb152723226ef.tar.gz
dinobot-ed04bd3c0fff100f40ed45d300fcb152723226ef.tar.xz
Move response validation out of main code.
Diffstat (limited to 'dinobot.rb')
-rw-r--r--dinobot.rb21
1 files changed, 0 insertions, 21 deletions
diff --git a/dinobot.rb b/dinobot.rb
index 752ca7e..503a3b4 100644
--- a/dinobot.rb
+++ b/dinobot.rb
@@ -139,7 +139,6 @@ module Dinobot
exec_command(m, command)
unless m.response.empty?
- ensure_valid_response(m.response)
process_response(m.response)
end
end
@@ -162,15 +161,12 @@ module Dinobot
if m.response.empty?
@modules[mod].call(m, command)
else
- ensure_valid_response(m.response)
-
prev = m.response
m.response = []
prev.each do |x|
if x.first == :say
@modules[mod].call(m, "#{command} #{x[2]}")
- ensure_valid_response(m.response)
else
m.response << x
end
@@ -186,22 +182,5 @@ module Dinobot
send(*x)
end
end
-
- def ensure_valid_response(response)
- raise "method list not array -- #{response}" unless response.is_a?(Array)
-
- response.each do |x|
- raise "method not array -- #{x}" unless x.is_a?(Array)
-
- case x.first
- when :say
- raise "wrong number of arguments -- #{x}" unless x.length == 3
- when :join, :part, :quit
- raise "wrong number of arguments -- #{x}" unless x.length == 2
- else
- raise "unknown method name -- #{x}"
- end
- end
- end
end
end