<commit_before>class RedRead::CLI

  BASE_URL = "https://www.reddit.com"

  def call
    start
  end

  def make_reddits(subreddit_url)
    reddits_array = Scraper.scrape_subreddit_page(subreddit_url)
    Reddit.delete
    Reddit.create_from_collection(reddits_array)
  end

  def display_reddits
    Reddit.all.each.with_index(1) do |reddit, i|
      puts "#{i}. ".colorize(:light_blue) + "#{reddit.title}"
    end
  end

  def add_attributes_to_reddit(reddit)
    attributes_hash = Scraper.scrape_reddit_page(reddit.url)
    reddit.add_reddit_attributes(attributes_hash)
  end

  def display_reddit_attributes(reddit)
    puts "--------------------------------------------------".colorize(:blue)
    puts "Title: ".colorize(:light_blue) + "#{reddit.title}"
    puts ""
    puts "Description: ".colorize(:light_blue) + " #{reddit.description}"
    puts ""
    puts "Top Comment: ".colorize(:light_blue) + "#{reddit.top_comment}"
    puts "--------------------------------------------------".colorize(:blue)
  end

  def get_subreddit
    puts "Enter a subreddit:"
    subreddit_input = gets.strip
    puts ""
    subreddit_url = BASE_URL + "/r/" + subreddit_input
    make_reddits(subreddit_url)
    display_reddits
  end

  def start
    puts "Reddit Reader"
    get_subreddit
    input = nil
    while input != "exit"
      puts ""
      puts "What reddit would you more information on, by number?"
      puts ""
      puts "Enter list to see the reddits again."
      puts "Enter new to enter another subreddit."
      puts "Enter exit to end the program."
      puts ""
      input = gets.strip
      puts ""
      if input == "list"
        display_reddits
      elsif input == "new"
        get_subreddit
      elsif input.to_i > 0
        if reddit = Reddit.all[input.to_i - 1]
          add_attributes_to_reddit(reddit)
          display_reddit_attributes(reddit)
        end
      end
    end
    puts "Goodbye!"
  end

end
<commit_msg>Added URL to display_reddit_attributes<commit_after>class RedRead::CLI

  BASE_URL = "https://www.reddit.com"

  def call
    start
  end

  def make_reddits(subreddit_url)
    reddits_array = Scraper.scrape_subreddit_page(subreddit_url)
    Reddit.delete
    Reddit.create_from_collection(reddits_array)
  end

  def display_reddits
    Reddit.all.each.with_index(1) do |reddit, i|
      puts "#{i}. ".colorize(:light_blue) + "#{reddit.title}"
    end
  end

  def add_attributes_to_reddit(reddit)
    attributes_hash = Scraper.scrape_reddit_page(reddit.url)
    reddit.add_reddit_attributes(attributes_hash)
  end

  def display_reddit_attributes(reddit)
    puts "--------------------------------------------------".colorize(:blue)
    puts "Title: ".colorize(:light_blue) + "#{reddit.title}"
    puts ""
    puts "Description: ".colorize(:light_blue) + " #{reddit.description}"
    puts ""
    puts "Top Comment: ".colorize(:light_blue) + "#{reddit.top_comment}"
    puts ""
    puts "URL: ".colorize(:light_blue) + "#{reddit.url}"
    puts "--------------------------------------------------".colorize(:blue)
  end

  def get_subreddit
    puts "Enter a subreddit:"
    subreddit_input = gets.strip
    puts ""
    subreddit_url = BASE_URL + "/r/" + subreddit_input
    make_reddits(subreddit_url)
    display_reddits
  end

  def start
    puts "Reddit Reader"
    get_subreddit
    input = nil
    while input != "exit"
      puts ""
      puts "What reddit would you more information on, by number?"
      puts ""
      puts "Enter list to see the reddits again."
      puts "Enter new to enter another subreddit."
      puts "Enter exit to end the program."
      puts ""
      input = gets.strip
      puts ""
      if input == "list"
        display_reddits
      elsif input == "new"
        get_subreddit
      elsif input.to_i > 0
        if reddit = Reddit.all[input.to_i - 1]
          add_attributes_to_reddit(reddit)
          display_reddit_attributes(reddit)
        end
      end
    end
    puts "Goodbye!"
  end

end

{'fraction_non_alphanumeric': 0.14801806322127445, 'fraction_numerical': 0.0015052684395383843, 'mean_word_length': 2.3252710592160133, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, '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': '1635471', 'n_tokens_mistral': 1255, 'n_tokens_neox': 1342, 'n_words': 296}