Class: File
- Inherits:
-
Object
- Object
- File
- Defined in:
- lib/miga/common/path.rb
Overview
MiGA extensions to the File class.
Class Method Summary collapse
-
.generic_transfer(old_name, new_name, method) ⇒ Object
Method to transfer a file from
old_name
tonew_name
, using amethod
that can be one of :symlink for File#symlink, :hardlink for File#link, or :copy for FileUtils#cp_r.
Class Method Details
.generic_transfer(old_name, new_name, method) ⇒ Object
Method to transfer a file from old_name
to new_name
, using a method
that can be one of :symlink for File#symlink, :hardlink for File#link, or :copy for FileUtils#cp_r.
25 26 27 28 29 30 31 32 33 34 |
# File 'lib/miga/common/path.rb', line 25 def self.generic_transfer(old_name, new_name, method) return nil if exist? new_name if (method == :copy) FileUtils.cp_r(old_name, new_name) else method = :link if method == :hardlink File.send(method, old_name, new_name) end end |