make_exclude_paths

in benchmarks/path_tree_benchmark.rb [54:84]


    def make_exclude_paths
      NUM_EXCLUDES.times.collect do
        base_dir = dir_names[rand(dir_names.count + 1)]
        next unless base_dir.present?
        case rand(3)
        when 0 
          base_dir
        when 1 
          pieces = base_dir.split(File::SEPARATOR)
          if pieces.count > (REPO_DEPTH / 10) && pieces.count < REPO_DEPTH
            File.join(base_dir, "**", "*")
          else
            base_dir
          end
        when 2 
          pieces = base_dir.split(File::SEPARATOR)
          if pieces.count > (REPO_DEPTH / 10) && pieces.count < REPO_DEPTH
            File.join(pieces.map do |piece|
              if rand(100) > 65
                piece[0..(1 + rand(piece[0].length))] + "*"
              else
                piece
              end
            end)
          else
            base_dir
          end
        end
      end.reject(&:nil?)
    end