generate.rb
#Read input text file line by line into an array
Read input text file line by line into an array
Read input text file line by line into an array
def processInput()
  textArray = []
  videoArray = []
  File.foreach("./data/input.txt").with_index do |line, line_num|
    if line[0] == "#"
      next   
     end
     nline = line.chomp
     values = nline.split(",")
     contentType = values[3]
     if contentType == "html" || contentType == "pdf" || contentType == "text"
       textArray.push(nline)
     elsif contentType == "video"
       videoArray.push(nline)
     else 
       puts "not found html line"
     end
  end
  $links["textArray"] = textArray 
  $links["videoArray"] = videoArray 
end
def processInput ( ) textArray = [ ] videoArray = [ ] File . foreach ( "./data/input.txt" ) . with_index do | line , line_num | if line [ 0 ] == "#" next end nline = line . chomp values = nline . split ( "," ) contentType = values [ 3 ] if contentType == "html" || contentType == "pdf" || contentType == "text" textArray . push ( nline ) elsif contentType == "video" videoArray . push ( nline ) else puts "not found html line" end end $links [ "textArray" ] = textArray $links [ "videoArray" ] = videoArray end
Read input text file line by line into an array
Read input text file line by line into an array
# puts "Found comment, ignoring" # Re-populate hash-map