Skip to content

Instantly share code, notes, and snippets.

@nextacademy-private
Created August 31, 2014 09:09
Show Gist options
  • Save nextacademy-private/1529da42e73b2e682704 to your computer and use it in GitHub Desktop.
Save nextacademy-private/1529da42e73b2e682704 to your computer and use it in GitHub Desktop.
require 'net/http'
require 'nokogiri'
require_relative 'util'
class Browser
def run!
# Run the browser
# Display a prompt for a user
# Parse their input
# Display useful results by instantiating
# a new Page and calling methods on it.
# Questions:
# 1. How can a user quit the browser gracefully?
# 2. How can a user ask for help, i.e., how do they know what commands are available to them?
end
end
Browser.new.run!
class Page
def initialize(url)
end
def fetch!
end
def title
end
def links
# Research alert!
# How do you use Nokogiri to extract all the link URLs on a page?
#
# These should only be URLs that look like
# <a href="http://somesite.com/page.html">Click here!</a>
# This would pull out "http://somesite.com/page.html"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment