Class: Hiptest::FileWriter
- Inherits:
-
Object
- Object
- Hiptest::FileWriter
- Defined in:
- lib/hiptest-publisher/file_writer.rb
Instance Method Summary collapse
-
#initialize(reporter) ⇒ FileWriter
constructor
A new instance of FileWriter.
- #write_to_file(path, message) ⇒ Object
Constructor Details
#initialize(reporter) ⇒ FileWriter
Returns a new instance of FileWriter.
5 6 7 |
# File 'lib/hiptest-publisher/file_writer.rb', line 5 def initialize(reporter) @reporter = reporter end |
Instance Method Details
#write_to_file(path, message) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/hiptest-publisher/file_writer.rb', line 9 def write_to_file(path, ) @reporter. "#{}: #{path}" do mkdirs_for(path) content = yield File.open(path, 'w') do |file| file.write(content) end end rescue => err @reporter.dump_error(err) end |