vendredi 10 avril 2015

\t works on irb but not in my ruby script

I have 2 path variables as per below: path1 = "../home/result_file.erb" path2 = "../my_folder/Data_file.erb"


I create an anchor tag links sting to pass it to my erb file. The string code is:



file_links_string = "<a href='#{path1}'>Result Report</a>\t\t\t<a href='#{path2}'>Data Report</a>"
p file_links_string


When I do puts "<a href='../home/result_file.erb'>Result Report</a>\t\t\t<a href='../my_folder/Data_file.erb'>Data Report</a>" on irb, it prints the two href tags with tab spaces in between.


But my p file_links_string prints "<a href='../home/result_file.erb'>Result Report</a>\t\t\t<a href='../my_folder/Data_file.erb'>Data Report</a>" on console. Looks like it considers '\t' as a string.


On my webpage I am getting Result Report and Data Report next to each other without tab spaces in between.


Am I creating the string incorrectly? Or do I need to add anything? I am using 2.1.1 ruby.


Aucun commentaire:

Enregistrer un commentaire