Created
June 7, 2016 22:08
-
-
Save dotspencer/e7e9d6a51ad0146ed57155c4e1844c6b to your computer and use it in GitHub Desktop.
First Ruby tool
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 'sinatra' | |
require 'open-uri' | |
def staff | |
url = "https://egi.utah.edu/about/staff/?mode=quick" | |
text = URI.parse(url).read | |
output = "" | |
text.each_line do |line| | |
if line.include? "class=\"staff\">" | |
cleaning = line.split("class=\"staff\"\>")[1] | |
result = cleaning.split("<br/>")[0] | |
output += "<li>#{result}</li> " | |
end | |
end | |
return output | |
end | |
get '/' do | |
"<link href='style.css' rel='stylesheet' type='text/css'>" + | |
"<a href='staff'>View Staff</a>" | |
end | |
get '/staff' do | |
"<link href='style.css' rel='stylesheet' type='text/css'>" + | |
staff | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment