class Object
Public Instance Methods
get_makes()
click to toggle source
# File lib/autostats.rb, line 21 def get_makes() car_page = Nokogiri::HTML(open("http://autos.aol.com")) makes = car_page.xpath("//div[@id = 'car_search_research_makes']/ul/li/a").collect{ |make| make.text + "\n" } end
get_models(make)
click to toggle source
# File lib/autostats.rb, line 26 def get_models(make) car_page = Nokogiri::HTML(open("http://autos.aol.com/#{make.downcase}")) if car_page.xpath("//title").text == "Site Map - AOL Autos" puts "make #{make} does not exist" raise MakeDoesNotExist end models = car_page.xpath("//li[@class = 'sub_title']/a") model_name_list = [] models.each do |model| model_name_list << model.text[(6 + make.size)..model.text.size] # strip year and make from text end model_name_list end