summaryrefslogtreecommitdiff
path: root/lib/pathname.rb
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-12-03 18:51:23 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-12-03 18:51:23 +0000
commitdc9603bd5c6b9618e1f4aa8a48c020c56425366f (patch)
treec32c600f1ded10a0a96c936e69b0b20e1ec0cf91 /lib/pathname.rb
parent4f5976cbb826df462c62a0a8e72ebe91c15a7ba4 (diff)
* lib/pathname.rb (Pathname#link, Pathname#symlink): obsoleted.
(Pathname#make_link, Pathname#make_symlink): new method. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5097 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/pathname.rb')
-rw-r--r--lib/pathname.rb18
1 files changed, 16 insertions, 2 deletions
diff --git a/lib/pathname.rb b/lib/pathname.rb
index 027886ccd0..0cd0c9a377 100644
--- a/lib/pathname.rb
+++ b/lib/pathname.rb
@@ -360,13 +360,13 @@ class Pathname
def fnmatch(pattern, *args) File.fnmatch(pattern, @path, *args) end
def fnmatch?(pattern, *args) File.fnmatch?(pattern, @path, *args) end
def ftype() File.ftype(@path) end
- def link(old) File.link(old, @path) end
+ def make_link(old) File.link(old, @path) end
def open(*args, &block) File.open(@path, *args, &block) end
def readlink() Pathname.new(File.readlink(@path)) end
def rename(to) File.rename(@path, to) end
def stat() File.stat(@path) end
def lstat() File.lstat(@path) end
- def symlink(old) File.symlink(old, @path) end
+ def make_symlink(old) File.symlink(old, @path) end
def truncate(length) File.truncate(@path, length) end
def utime(atime, mtime) File.utime(atime, mtime, @path) end
def basename(*args) Pathname.new(File.basename(@path, *args)) end
@@ -374,6 +374,20 @@ class Pathname
def extname() File.extname(@path) end
def expand_path(*args) Pathname.new(File.expand_path(@path, *args)) end
def split() File.split(@path).map {|f| Pathname.new(f) } end
+
+ # Pathname#link is confusing and obsoleted because the receiver/argument
+ # order is inverted to corresponding system call.
+ def link(old)
+ warn 'Pathname#link is obsoleted. Use Pathname#make_link.'
+ File.link(old, @path)
+ end
+
+ # Pathname#symlink is confusing and obsoleted because the receiver/argument
+ # order is inverted to corresponding system call.
+ def symlink(old)
+ warn 'Pathname#symlink is obsoleted. Use Pathname#make_symlink.'
+ File.symlink(old, @path)
+ end
end
# FileTest