Class: Caco::Downloader

Inherits:
Trailblazer::Operation
  • Object
show all
Defined in:
lib/caco/downloader.rb

Constant Summary collapse

Stubbed =
Class.new(Trailblazer::Activity::Signal)

Instance Method Summary collapse

Instance Method Details

#write_file(ctx, tempfile:, dest:) ⇒ Object



32
33
34
35
36
37
38
39
# File 'lib/caco/downloader.rb', line 32

def write_file(ctx, tempfile:, dest:, **)
  if Caco.config.write_files
    FileUtils.mkdir_p(File.dirname(dest))
    File.rename tempfile.path, dest
  else
    tempfile.unlink
  end
end