Class: FileWriter

Inherits:
Writer show all
Defined in:
lib/teuton-get/writer/file_writer.rb

Instance Method Summary collapse

Instance Method Details

#closeObject



19
20
21
# File 'lib/teuton-get/writer/file_writer.rb', line 19

def close
  @file.close
end

#open(filepath) ⇒ Object



5
6
7
8
9
# File 'lib/teuton-get/writer/file_writer.rb', line 5

def open(filepath)
  dirpath = File.dirname(filepath)
  FileUtils.mkdir_p(dirpath) unless Dir.exist? dirpath
  @file = File.open(filepath, "w")
end

#write(text) ⇒ Object



11
12
13
# File 'lib/teuton-get/writer/file_writer.rb', line 11

def write(text)
  @file.write text
end

#writeln(text) ⇒ Object



15
16
17
# File 'lib/teuton-get/writer/file_writer.rb', line 15

def writeln(text)
  @file.write text
end