Created
October 1, 2014 03:30
-
-
Save elskwid/cb436327088d58d0e65d to your computer and use it in GitHub Desktop.
wip data
This file contains 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
# original data | |
# https://www.cisweb1.unr.edu/cxs/CourseListing.asp?master_id=1955&course_area=BASE&course_number=105&course_subtitle=00 | |
data = File.read("data.txt") | |
lines = data.split("\n") | |
def extract_value_from_line(line, delimiter = ":") | |
line.split(delimiter)[1].to_s.strip | |
end | |
hash = {} | |
hash["course"] = extract_value_from_line(lines[0]) | |
hash["term"] = extract_value_from_line(lines[1]) | |
hash["section number"] = extract_value_from_line(lines[2]) | |
hash["schedule number"] = extract_value_from_line(lines[3]) | |
# consecutive lines | |
# same split token | |
# split() | |
# same index in split array | |
# to_s | |
# strip | |
puts hash.inspect |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment