/browser.rb Secret
Created
August 31, 2014 09:09
-
Star
(0)
You must be signed in to star a gist -
Fork
(113)
You must be signed in to fork a gist
-
-
Save nextacademy-private/1529da42e73b2e682704 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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