Ruby 文件IO

2019PHP高薪工程师学习路线图....>>>

class Filetest
	attr_accessor :filename

	def initialize(filename)
		@filename = filename
	end

	def puts_file
		File.open(@filename, "r") do |file|
			while line = file.gets
				puts line
			end
		end
	end

end

file = Filetest.new("test")

file.puts_file