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