You could do it by lines or by words. If you want to index the words by line numbers, you could probably take a little from both options.
# Option 1: Reads file as an Array of lines, but we need to replace (gsub) the newline character at the end of each line
lines_with_newlines = File.readlines("hello.txt").map{|line| line.gsub(/\n$/,"")}
# Option 2: If you wanted to do it by words instead of lines by cleaning up some whitespace
list_of_words = File.read("hello.txt").gsub(/\n/, " ").gsub(/^\s+/,"").gsub(/\s+$/,"").split(/\s/)
# Generates a list of line numbers, starting with 1
line_numbers = (1..(lines.length + 1))
# "Zips" up the line numbers [["line 1", 1], ["line 2", 2]]
pairs = lines.zip(line_numbers)
# Converts to Array
hash = Hash[pairs]