class Roadfood::Review
Attributes
address[RW]
body[RW]
city[RW]
date_published[RW]
dishes_to_try[RW]
name[RW]
rating[RW]
state[RW]
url[RW]
website[RW]
Public Class Methods
all()
click to toggle source
# File lib/roadfood/review.rb, line 21 def self.all @@all end
find(index)
click to toggle source
# File lib/roadfood/review.rb, line 25 def self.find(index) self.all[index-1] end
new(name=nil, city=nil, state=nil, url=nil)
click to toggle source
# File lib/roadfood/review.rb, line 6 def initialize(name=nil, city=nil, state=nil, url=nil) @name = name @city = city @state = state @url = url @@all << self end
new_from_index_page(r)
click to toggle source
# File lib/roadfood/review.rb, line 14 def self.new_from_index_page(r) self.new(r.css("h2").text, r.css(".address").text.strip.split(",")[1].strip, r.css(".address").text.strip.split(",").last.strip, r.css("h2 a").attribute("href").value) end
Public Instance Methods
doc()
click to toggle source
# File lib/roadfood/review.rb, line 29 def doc @doc ||= Nokogiri::HTML(open(self.url)) end