我正在嘗試讀取文件名並處理每一行。如何將文件名傳遞給函數?通過將文件傳遞給函數來讀取文件
puts "file name?? "
_file = get.chomps
def printFile(_file)
do |f|
f.each_line do |line|
print_me = "Line 1 " + line
return print_me
end
end
end
我打算通過print_me
像另一個功能:
def thisWillPrint(print_me)
new_print = print_me + " DONE! "
end