Class: Munge::Core::Write
- Inherits:
-
Object
- Object
- Munge::Core::Write
- Defined in:
- lib/munge/core/write.rb
Instance Method Summary collapse
-
#initialize(output:) ⇒ Write
constructor
A new instance of Write.
- #write(relpath, content) ⇒ Object
Constructor Details
#initialize(output:) ⇒ Write
4 5 6 |
# File 'lib/munge/core/write.rb', line 4 def initialize(output:) @output = output end |
Instance Method Details
#write(relpath, content) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/munge/core/write.rb', line 8 def write(relpath, content) abspath = File.join(@output, relpath) FileUtils.mkdir_p(File.dirname(abspath)) if File.exist?(abspath) && File.read(abspath) == content return false else File.write(abspath, content) true end end |