Created
August 23, 2011 14:38
-
-
Save jdkealy/1165297 to your computer and use it in GitHub Desktop.
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
#loop through tsv, add to array | |
f = File.open(input_file, "r") | |
f.each_with_index { |line, i| | |
name_index = "" | |
price_index = "" | |
if(i==0) then | |
headers = line.split("\t") | |
headers[2] = headers.last.strip | |
name_index = headers.index("Name") | |
price_index = headers.index("Price") | |
end | |
next if i == 0 | |
next if line[0] == "#" | |
words = line.split("\t") | |
p = Output.new | |
puts name_index | |
p.name = words[0] | |
p.price = words[2].to_f | |
arr.push(p) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment