lib/scrapper.rb
# this block parse the raw site as an object to the parsed page variable
# cars.count returns the number of cars on the page
this block parse the raw site as an object to the parsed page variable
cars.count returns the number of cars on the page
this block parse the raw site as an object to the parsed page variable cars . count returns the number of cars on the page
def scrape
    parsed_page = parse_url(@url)
    cars = parsed_page.css('div.searchResults')
    cars_perpage = cars.count
    total_listings = parsed_page.css('#mainContentPlaceholder_vehicleCountWithin').text.to_i
    total_pages = get_number_of_pages(total_listings, cars_perpage)
    first_page = create_car_hash(cars)
    all_other = build_full_cars(total_pages)
    first_page + all_other.flatten
  end
def scrape parsed_page = parse_url ( @url ) cars = parsed_page . css ( 'div.searchResults' ) cars_perpage = cars . count total_listings = parsed_page . css ( '#mainContentPlaceholder_vehicleCountWithin' ) . text . to_i total_pages = get_number_of_pages ( total_listings , cars_perpage ) first_page = create_car_hash ( cars ) all_other = build_full_cars ( total_pages ) first_page + all_other . flatten end
this block parse the raw site as an object to the parsed page variable
cars.count returns the number of cars on the page
this block parse the raw site as an object to the parsed page variable cars . count returns the number of cars on the page
# create a method that links for other pages