Class: File
- Inherits:
-
Object
- Object
- File
- Defined in:
- lib/miga/common.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_nametonew_name, using amethodthat 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.
146 147 148 149 150 151 152 153 154 155 156 157 158 |
# File 'lib/miga/common.rb', line 146 def self.generic_transfer(old_name, new_name, method) return nil if exist? new_name case method when :symlink File.symlink(old_name, new_name) when :hardlink File.link(old_name, new_name) when :copy FileUtils.cp_r(old_name, new_name) else raise "Unknown transfer method: #{method}." end end |