class Scraper

Public Instance Methods

get_page() click to toggle source
# File lib/50_best_restaurants/scraper.rb, line 3
def get_page
  Nokogiri::HTML(open("http://www.theworlds50best.com/list/1-50-winners"))
end
make_restaurants() click to toggle source
# File lib/50_best_restaurants/scraper.rb, line 11
def make_restaurants
  scrape_restaurants_index.each do |r| 
    restaurant = Restaurant.new
    restaurant.position = r.css(".position").text
    restaurant.location = r.css("h3").text
    restaurant.name = r.css("h2").text
    restaurant.url = "http://www.theworlds50best.com" + r.css("a").attribute("href").text
  end  
end
scrape_restaurants_index() click to toggle source
# File lib/50_best_restaurants/scraper.rb, line 7
def scrape_restaurants_index
  self.get_page.css("div#t1-50 li")
end