Class: CryptReboot::FilesWriter
- Inherits:
-
Object
- Object
- CryptReboot::FilesWriter
- Defined in:
- lib/crypt_reboot/files_writer.rb
Overview
Writes files from hash to specified directory
Instance Method Summary collapse
Instance Method Details
#call(files, target_dir) ⇒ Object
8 9 10 11 12 13 14 15 |
# File 'lib/crypt_reboot/files_writer.rb', line 8 def call(files, target_dir) files.each do |relative_path, content| path = File.join(target_dir, relative_path) dir = File.dirname(path) FileUtils.mkdir_p(dir) unless File.directory?(dir) File.binwrite(path, content) end end |