<commit_before>class FavoriteCookingClasses::CookingClass
  @@all = []
  @@base_url = "http://www.surlatable.com/"
  def initialize(name = nil, url = nil, description = nil, menu = nil)
    @name = name
    @url = url
    @description = description
    @menu = menu
    @@all << self
  end
  
  def self.scrape_customer_favorites
    doc = Nokogiri::HTML(open(@@base_url + "category/cat2211278/Find+a+Cooking+Class"))
    customer_favorites = doc.css("div.boxsides").first

    customer_favorites.css("div.product a").each_with_index do |the_class, i|
      favorite_class = self.new
      favorite_class.name = the_class.children[1]['alt'].sub!('Cooking Class: ', '')
      favorite_class.url = the_class['href']
    end
    @@all
  end
  def description
    class_details = Nokogiri::HTML(open(@@base_url + "#{self.url}"))
    @description.nil? ? @description = class_details.css("div.boxsides").children[6].text : @description
  end
  def menu
    class_details = Nokogiri::HTML(open(@@base_url + "#{self.url}"))
    @menu.nil? ? @menu = class_details.css("div.boxsides").children[2].text : @menu
  end
end<commit_msg>define all and update scrape_customer_favorites<commit_after>class FavoriteCookingClasses::CookingClass
  @@all = []
  @@base_url = "http://www.surlatable.com/"
  
  def initialize(name = nil, url = nil, description = nil, menu = nil)
    @name = name
    @url = url
    @description = description
    @menu = menu
    @@all << self
  end
  
  def self.all
    @@all.empty? ? scrape_customer_favorites : @@all
  end
  
  def self.scrape_customer_favorites
    doc = Nokogiri::HTML(open(@@base_url + "category/cat2211278/Find+a+Cooking+Class"))
    customer_favorites = doc.css("div.boxsides").first

    customer_favorites.css("div.product a").each do |the_class|
      favorite_class = self.new
      favorite_class.name = the_class.children[1]['alt'].sub!('Cooking Class: ', '')
      favorite_class.url = the_class['href']
    end
    @@all
  end
  def description
    class_details = Nokogiri::HTML(open(@@base_url + "#{self.url}"))
    @description.nil? ? @description = class_details.css("div.boxsides").children[6].text : @description
  end
  def menu
    class_details = Nokogiri::HTML(open(@@base_url + "#{self.url}"))
    @menu.nil? ? @menu = class_details.css("div.boxsides").children[2].text : @menu
  end
end
{'fraction_non_alphanumeric': 0.15286080273270708, 'fraction_numerical': 0.008539709649871904, 'mean_word_length': 3.88125, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, 'https://': 0, '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': '5358347', 'n_tokens_mistral': 838, 'n_tokens_neox': 811, 'n_words': 144}