Sha256: b8b71e661026d750ecf72f9ad8405669bd1278643403608945d2e9193336504e
Contents?: true
Size: 379 Bytes
Versions: 4
Compression:
Stored size: 379 Bytes
Contents
require "fileutils" module Coolkit # Append data to the end of a file. # The file is created if it doesn"t exist. # # @param file [String] Path to the file. # @param data [String,#to_s] Data to write to the file. # @return [void] def self.write_to_file(file, data) FileUtils.mkdir_p(File.dirname(file)) File.open(file, "a") { |f| f.write(data) } end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
coolkit-0.2.2 | lib/coolkit/filesystem.rb |
coolkit-0.2.1 | lib/coolkit/filesystem.rb |
coolkit-0.2.0 | lib/coolkit/filesystem.rb |
coolkit-0.1.0 | lib/coolkit/filesystem.rb |