From b3004a38f1944376c470d4f5b61b1a0761e405be Mon Sep 17 00:00:00 2001 From: Dmitry Kim Date: Tue, 20 Mar 2007 01:14:35 +0000 Subject: * tidying up 'help ignored plugins' output --- lib/rbot/plugins.rb | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'lib/rbot') diff --git a/lib/rbot/plugins.rb b/lib/rbot/plugins.rb index 80ac2f1c..7b476da9 100644 --- a/lib/rbot/plugins.rb +++ b/lib/rbot/plugins.rb @@ -531,15 +531,19 @@ module Plugins }.join("\n") when /ignored?\s*plugins?/ return "no plugins were ignored" if @ignored.empty? - return @ignored.inject(Array.new) { |list, p| - case p[:reason] - when :loaded - list << "#{p[:name]} in #{p[:dir]} (overruled by previous)" - else - list << "#{p[:name]} in #{p[:dir]} (#{p[:reason].to_s})" - end - list - }.join(", ") + + tmp = Hash.new + @ignored.each do |p| + reason = p[:loaded] ? 'overruled by previous' : p[:reason].to_s + ((tmp[p[:dir]] ||= Hash.new)[reason] ||= Array.new).push(p[:name]) + end + + return tmp.map do |dir, reasons| + s = reasons.map { |r, list| + list.map { |_| _.sub(/\.rb$/, '') }.join(', ') + " (#{r})" + }.join('; ') + "in #{dir}: #{s}" + end.join('; ') when /^(\S+)\s*(.*)$/ key = $1 params = $2 -- cgit v1.2.3