<commit_before>class ProjectsController
  def index
    if Project.count > 0
      projects = Project.all # All of the projects in an array
      projects.each_with_index do |project, index|
        say("#{index + 1}. #{project.name}")
      end
    else
      say("No projects found. Add a project.\n")
    end<commit_msg>Refactored ProjectsController to output a string.<commit_after>require 'highline/import'

class ProjectsController
  def index
    if Project.count > 0
      projects = Project.all # All of the projects in an array
      projects_string = ""
      projects.each_with_index do |project, index|
        projects_string << "#{index + 1}. #{project.name}\n"
      end
      projects_string
    else
      "No projects found. Add a project.\n"
    end
  end

  def add(name)
    name_cleaned = name.strip
    unless /^\d+$/.match(name_cleaned)
      Project.create(name_cleaned)
      name_cleaned
    end
{'fraction_non_alphanumeric': 0.09317443120260022, 'fraction_numerical': 0.004333694474539545, 'mean_word_length': 2.6377952755905514, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1673304', 'n_tokens_mistral': 278, 'n_tokens_neox': 269, 'n_words': 83}