Ruby 文件IO

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

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