Sha256: 6a0aa942b91a5a556c83c8d7cbe76ee42bed58541f66e0e2d6f6b9c6da788aaa
Contents?: true
Size: 428 Bytes
Versions: 24
Compression:
Stored size: 428 Bytes
Contents
# encoding: utf-8 require 'fileutils' module FileHelper def create_file(file_path, content) file_path = File.expand_path(file_path) dir_path = File.dirname(file_path) FileUtils.makedirs dir_path unless File.exists?(dir_path) File.open(file_path, 'w') do |file| case content when String file.puts content when Array file.puts content.join("\n") end end end end
Version data entries
24 entries across 24 versions & 3 rubygems