Class: MKBrut::Ops::CopyFile

Inherits:
BaseOp
  • Object
show all
Defined in:
lib/mkbrut/ops/copy_file.rb

Instance Method Summary collapse

Methods inherited from BaseOp

dry_run=, dry_run?, #dry_run?, fileutils_args, #fileutils_args

Constructor Details

#initialize(source, destination_root:) ⇒ CopyFile

Returns a new instance of CopyFile.



4
5
6
7
# File 'lib/mkbrut/ops/copy_file.rb', line 4

def initialize(source, destination_root:)
  @source           = source
  @destination_root = destination_root
end

Instance Method Details

#callObject



8
9
10
# File 'lib/mkbrut/ops/copy_file.rb', line 8

def call
  FileUtils.cp(@source, @destination_root / @source.basename, **fileutils_args)
end

#to_sObject



11
# File 'lib/mkbrut/ops/copy_file.rb', line 11

def to_s = "Copy '#{@source}' to '#{@destination_root}'"