Class: Scraper
- Inherits:
-
Object
- Object
- Scraper
- Defined in:
- lib/worlds_best_restaurants/scraper.rb
Instance Method Summary collapse
Instance Method Details
#get_page ⇒ Object
3 4 5 |
# File 'lib/worlds_best_restaurants/scraper.rb', line 3 def get_page Nokogiri::HTML(open("http://www.theworlds50best.com/list/1-50-winners")) end |
#make_restaurants ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/worlds_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 ⇒ Object
7 8 9 |
# File 'lib/worlds_best_restaurants/scraper.rb', line 7 def scrape_restaurants_index self.get_page.css("div#t1-50 li") end |