jeudi 16 mai 2019

How to push into arrays when reading ruby files?

I've followed the tutorial about how to read a text file with ruby with the purposes of printing it out with arrays, but it doesn't seem like working... here are the attempts in test.rb.

tutorial:https://www.codecademy.com/articles/writing-to-file-ruby

this test list file is successfully printing put in the console but its not in an array, how do I turn it into array? thanks!

test.rb 
class File
File.open("test_list.txt").each do  |line|

puts line
def ProcessText
    test_list.txt = File.to_s

end
end
end 

Aucun commentaire:

Enregistrer un commentaire