Sha256: f67d97ef4ebaef4905df74aa7da969d3e3c8a2e49bf5d41465106029a1f074a1

Contents?: true

Size: 420 Bytes

Versions: 7

Compression:

Stored size: 420 Bytes

Contents

# -*- encoding: utf-8 -*-

require 'fileutils'

module Genit

  # Write a file on disk.
  class FileWriter
    
    def self.write content, full_path
      create_dirs full_path
      File.open(full_path, "w") {|out| out.puts content }
    end
    
    private
    
    def self.create_dirs full_path
      dir = File.dirname full_path
      FileUtils.makedirs(dir) unless File.directory?(dir)
    end
    
  end
  
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
genit-2.1 lib/genit/utils/file_writer.rb
genit-2.0 lib/genit/utils/file_writer.rb
genit-1.0.1 lib/genit/utils/file_writer.rb
genit-1.0 lib/genit/utils/file_writer.rb
genit-0.99 lib/genit/utils/file_writer.rb
genit-0.9 lib/genit/utils/file_writer.rb
genit-0.5 lib/genit/file_writer.rb