Class: Approvals::Writers::TextWriter
- Inherits:
-
Object
- Object
- Approvals::Writers::TextWriter
show all
- Defined in:
- lib/approvals/writers/text_writer.rb
Instance Method Summary
collapse
Instance Method Details
#extension ⇒ Object
4
5
6
|
# File 'lib/approvals/writers/text_writer.rb', line 4
def extension
'txt'
end
|
15
16
17
|
# File 'lib/approvals/writers/text_writer.rb', line 15
def format(data)
data.to_s
end
|
#write(data, path) ⇒ Object
8
9
10
11
12
13
|
# File 'lib/approvals/writers/text_writer.rb', line 8
def write(data, path)
FileUtils.mkdir_p(File.dirname(path))
File.open(path, 'w') do |f|
f.write format(data)
end
end
|