I am reading a file which has source code. I need to append 2 spaces before each line. This is what I am doing.
data = read_file
data.split(/\n/).collect {|l| ' ' + l}.join('\n')
However after joining when I do puts then it prints \n literally and it is not a line break. How do I fix that?