Class: DependencySpy::Outputs::FileSystem

Inherits:
Object
  • Object
show all
Defined in:
lib/dependency_spy/outputs/file.rb

Class Method Summary collapse

Class Method Details

.write(path, output) ⇒ Object



21
22
23
24
25
26
27
28
29
# File 'lib/dependency_spy/outputs/file.rb', line 21

def self.write(path, output)
  file           = File.expand_path(path)
  path_directory = File.dirname(file)
  FileUtils.mkdir_p(path_directory) unless File.exist?(path_directory)

  File.open(file, 'wb') do |f|
    f.puts(output)
  end
end