I\'m trying to go through a file to check every line with what white space it starts. we want to use space as a start or a tab. If one line starts with space and another line wi
You should be able to use file.lineno to get the number of the current line you are reading in the file.
file.lineno
file = File.open("file_name") file.each do |line| ... puts "#{file.lineno}: #{line}" # Outputs the line number and the content of the line end