diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-08-08 10:29:16 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-08-08 10:29:16 +0000 |
commit | 239692dde86f19c9a13bace56082b1c290b1d7e9 (patch) | |
tree | 25eba177ecdecf9c18b800d391411a111794840c /ext/pathname | |
parent | 1c8c901e3c553bdd15d2a1e5e9d8ce4c5c6c7aa2 (diff) | |
download | ruby-239692dde86f19c9a13bace56082b1c290b1d7e9.tar.gz |
* ext/pathname/pathname.c (path_make_link): Pathname#make_link
translated from pathname.rb.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28923 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/pathname')
-rw-r--r-- | ext/pathname/lib/pathname.rb | 3 | ||||
-rw-r--r-- | ext/pathname/pathname.c | 13 |
2 files changed, 13 insertions, 3 deletions
diff --git a/ext/pathname/lib/pathname.rb b/ext/pathname/lib/pathname.rb index d2d3d8ac21..b685309e7c 100644 --- a/ext/pathname/lib/pathname.rb +++ b/ext/pathname/lib/pathname.rb @@ -512,9 +512,6 @@ end class Pathname # * File * - # See <tt>File.link</tt>. Creates a hard link. - def make_link(old) File.link(old, @path) end - # See <tt>File.open</tt>. Opens the file for reading or writing. def open(*args, &block) # :yield: file File.open(@path, *args, &block) diff --git a/ext/pathname/pathname.c b/ext/pathname/pathname.c index 4ed17f4efd..fb023f334e 100644 --- a/ext/pathname/pathname.c +++ b/ext/pathname/pathname.c @@ -325,6 +325,18 @@ path_ftype(VALUE self) } /* + * call-seq: + * pathname.make_link(old) + * + * See <tt>File.link</tt>. Creates a hard link at _pathname_. + */ +static VALUE +path_make_link(VALUE self, VALUE old) +{ + return rb_funcall(rb_cFile, rb_intern("link"), 2, old, get_strpath(self)); +} + +/* * == Pathname * * Pathname represents a pathname which locates a file in a filesystem. @@ -534,4 +546,5 @@ Init_pathname() rb_define_method(rb_cPathname, "fnmatch", path_fnmatch, -1); rb_define_method(rb_cPathname, "fnmatch?", path_fnmatch, -1); rb_define_method(rb_cPathname, "ftype", path_ftype, 0); + rb_define_method(rb_cPathname, "make_link", path_make_link, 1); } |