Sha256: e6994694bddc88bd7c61ac97c2b6493e70bf40c4209b526bd6efdb8576f09280
Contents?: true
Size: 555 Bytes
Versions: 7
Compression:
Stored size: 555 Bytes
Contents
class FileWriter def initialize() self.lines = [] self.current_line = '' end defm set_output_file(output_file) self.output_file = output_file end defm write(line) self.current_line = "#{self.current_line}#{line}" end defm writeln(line) self.flush_line() add(self.lines, line) end defm flush_line() unless self.current_line == '' add(self.lines, self.current_line) self.current_line = '' end end defm flush() self.flush_line() writefile(self.lines, self.output_file) end end
Version data entries
7 entries across 7 versions & 1 rubygems