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.
38 39 40 41 42 43 44 45 46 |
# File 'lib/miga/common/path.rb', line 38 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 |