<commit_before>class BookwormBestSellers::Book
  attr_accessor :title, :author, :description
  @@current_book_list = []

  def self.this_week
    if @@current_book_list == []
      @@current_book_list = self.scrape_books
    else
      @@current_book_list
    end
  end

  def self.scrape_books
    books = []
    self.scrape_titles.each do |ind_title|
      if books.length < 10
        book = self.new
        book.title = ind_title
        books << book
      end
    end
    books.each.with_index(0) do |ind_book, i|
      ind_book.author = self.scrape_authors[i]
    end
    books
  end

  def self.scrape_titles
    doc = Nokogiri::HTML(open("http://www.barnesandnoble.com/b/the-new-york-times-bestsellers-hardcover-nonfiction/_/N-1p5q"))
    title_array = doc.search("p.product-info-title").text.split("\n").reject { |item| item.nil? || item == "" }.map { |ind_title| ind_title[0...-13] }
    title_array
  end

  def self.scrape_authors
    doc = Nokogiri::HTML(open("http://www.barnesandnoble.com/b/the-new-york-times-bestsellers-hardcover-nonfiction/_/N-1p5q"))
    author_array = doc.search("span.contributor").to_s.split("/a").map! { |author| author[-25..-1] }.reject { |author| author.nil? || author == "" }.map! { |author| author.split(">")[1] }.map! { |ind_author| ind_author[0...-1] }
    author_array
  end

end<commit_msg>code cleanup in book.rb<commit_after>class BookwormBestSellers::Book
  attr_accessor :title, :author, :description
  @@current_book_list = []
  @@doc = Nokogiri::HTML(open("http://www.barnesandnoble.com/b/the-new-york-times-bestsellers-hardcover-nonfiction/_/N-1p5q"))

  def self.this_week
    if @@current_book_list == []
      @@current_book_list = self.scrape_books
    else
      @@current_book_list
    end
  end

  def self.scrape_books
    books = []
    self.scrape_titles.each do |ind_title|
      if books.length < 10
        book = self.new
        book.title = ind_title
        books << book
      end
    end
    books.each.with_index(0) do |ind_book, i|
      ind_book.author = self.scrape_authors[i]
    end
    books
  end

  def self.scrape_titles
    @@doc.search("p.product-info-title").text.split("\n").reject { |item| item.nil? || item == "" }.map { |ind_title| ind_title[0...-13] }
  end

  def self.scrape_authors
    @@doc.search("span.contributor").to_s.split("/a").map! { |author| author[-25..-1] }.reject { |author| author.nil? || author == "" }.map! { |author| author.split(">")[1] }.map! { |ind_author| ind_author[0...-1] }
  end

  def self.scrape_description

  end

end
{'fraction_non_alphanumeric': 0.16004718836020448, 'fraction_numerical': 0.011797090051120724, 'mean_word_length': 3.0834670947030496, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 3, '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': '226190', 'n_tokens_mistral': 989, 'n_tokens_neox': 937, 'n_words': 155}