class BestPizza::Restaurant
Attributes
area[RW]
description[RW]
name[RW]
Public Class Methods
find(id)
click to toggle source
# File lib/best_pizza/restaurant.rb, line 24 def self.find(id) self.pizza_restaurants[id.to_i - 1] end
pizza_restaurants()
click to toggle source
# File lib/best_pizza/restaurant.rb, line 7 def self.pizza_restaurants @@pizza_restaurants end
scrape_pizza()
click to toggle source
# File lib/best_pizza/restaurant.rb, line 11 def self.scrape_pizza doc = Nokogiri::HTML(open("https://www.thrillist.com/eat/new-york/the-best-pizza-in-new-york-city")) doc.css("section.save-venue.saveable-venue").collect do |info| pizza = self.new pizza.name = info.css('h1').text.strip pizza.area = info.css('h2').text.strip pizza.description = info.css('p.save-venue__description').text.strip self.pizza_restaurants << pizza end end