scan_files (ZenTest)

    # File lib/zentest.rb, line 234
      def scan_files(*files)
        assert_count = Hash.new(0)
        method_count = Hash.new(0)
        klassname = nil

        files.each do |path|
          is_loaded = false

          # if reading stdin, slurp the whole thing at once
          file = (path == "-" ? $stdin.read : File.new(path))

          file.each_line do |line|

            if klassname then
              case line
              when /^\s*def/ then
                method_count[klassname] += 1
              when /assert|flunk/ then
                assert_count[klassname] += 1
              end
            end

            if line =~ /^\s*(?:class|module)\s+([\w:]+)/ then
              klassname = $1

              if line =~ /\#\s*ZenTest SKIP/ then
                klassname = nil
                next
              end

              full = false
              if line =~ /\#\s*ZenTest FULL/ then
                full = true
              end

              unless is_loaded then
                unless path == "-" then
                  self.load_file(path)
                else
                  eval file, TOPLEVEL_BINDING
                end
                is_loaded = true
              end

              begin
                klassname = self.process_class(klassname, full)
              rescue
                puts "# Couldn't find class for name #{klassname}"
                next
              end

              # Special Case: ZenTest is already loaded since we are running it
              if klassname == "TestZenTest" then
                klassname = "ZenTest"
                self.process_class(klassname, false)
              end

            end # if /class/
          end # IO.foreach
        end # files

        result = []
        method_count.each_key do |classname|

          entry = {}

          next if is_test_class(classname)
          testclassname = convert_class_name(classname)
          a_count = assert_count[testclassname]
          m_count = method_count[classname]
          ratio = a_count.to_f / m_count.to_f * 100.0

          entry['n'] = classname
          entry['r'] = ratio
          entry['a'] = a_count
          entry['m'] = m_count

          result.push entry
        end

        sorted_results = result.sort { |a,b| b['r'] <=> a['r'] }

        @result.push sprintf("# %25s: %4s / %4s = %6s%%", "classname", "asrt", "meth", "ratio")
        sorted_results.each do |e|
          @result.push sprintf("# %25s: %4d / %4d = %6.2f%%", e['n'], e['a'], e['m'], e['r'])
        end
      end