* ext/pathname/pathname.c (path_readlink): Pathname#readlink translated

from pathname.rb.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28942 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2010-08-09 21:27:20 +00:00
Родитель ec5bb26fa0
Коммит 8aa17733fa
3 изменённых файлов: 19 добавлений и 5 удалений

Просмотреть файл

@ -1,7 +1,12 @@
Tue Aug 10 06:26:48 2010 Tanaka Akira <akr@fsij.org>
* ext/pathname/pathname.c (path_readlink): Pathname#readlink translated
from pathname.rb.
Mon Aug 9 22:15:19 2010 Tanaka Akira <akr@fsij.org>
* ext/pathname/pathname.c (path_open): Pathname#open
translated from pathname.rb.
* ext/pathname/pathname.c (path_open): Pathname#open translated from
pathname.rb.
Mon Aug 9 22:11:09 2010 Tanaka Akira <akr@fsij.org>

Просмотреть файл

@ -512,9 +512,6 @@ end
class Pathname # * File *
# See <tt>File.readlink</tt>. Read symbolic link.
def readlink() self.class.new(File.readlink(@path)) end
# See <tt>File.rename</tt>. Rename the file.
def rename(to) File.rename(@path, to) end

Просмотреть файл

@ -355,6 +355,17 @@ path_open(int argc, VALUE *argv, VALUE self)
}
}
/*
* See <tt>File.readlink</tt>. Read symbolic link.
*/
static VALUE
path_readlink(VALUE self)
{
VALUE str;
str = rb_funcall(rb_cFile, rb_intern("readlink"), 1, get_strpath(self));
return rb_class_new_instance(1, &str, rb_obj_class(self));
}
/*
* == Pathname
*
@ -567,4 +578,5 @@ Init_pathname()
rb_define_method(rb_cPathname, "ftype", path_ftype, 0);
rb_define_method(rb_cPathname, "make_link", path_make_link, 1);
rb_define_method(rb_cPathname, "open", path_open, -1);
rb_define_method(rb_cPathname, "readlink", path_readlink, 0);
}