Method: Pathname#move

Defined in:
lib/pleasant_path/pathname.rb

#move(destination) ⇒ Pathname

Moves the file or directory indicated by the Pathname to destination, in the same manner as FileUtils.mv. Returns destination as a Pathname.

Examples:

FileUtils.mkpath("dir/files")
FileUtils.touch("dir/files/file1")
FileUtils.mkpath("other_dir")

Pathname.new("dir/files").move("other_dir/same_files")
  # == Pathname.new("other_dir/same_files")

Dir.exist?("dir/files")                    # == false
File.exist?("other_dir/same_files/file1")  # == true

Parameters:

Returns:

See Also:



438
439
440
441
# File 'lib/pleasant_path/pathname.rb', line 438

def move(destination)
  FileUtils.mv(self, destination)
  destination.to_pathname
end