Module: CustomFileUtils

Included in:
OutputBuilder
Defined in:
lib/utils/custom_files_utils.rb

Instance Method Summary collapse

Instance Method Details

#create_empty_file(full_file_path) ⇒ Object



2
3
4
5
6
7
8
# File 'lib/utils/custom_files_utils.rb', line 2

def create_empty_file(full_file_path)
    dir = File.dirname(full_file_path)

    FileUtils.mkdir_p(dir) unless File.directory?(dir)
    
    File.new(full_file_path, 'w').close()
end

#write_file(path_to_file, file_content) ⇒ Object



10
11
12
13
14
15
# File 'lib/utils/custom_files_utils.rb', line 10

def write_file(path_to_file, file_content)
    create_empty_file path_to_file 
		open(path_to_file, 'w') do |f|		  
        f.puts file_content
    end
end