ruby-changes:16947
From: akr <ko1@a...>
Date: Tue, 10 Aug 2010 06:27:41 +0900 (JST)
Subject: [ruby-changes:16947] Ruby:r28942 (trunk): * ext/pathname/pathname.c (path_readlink): Pathname#readlink translated
akr 2010-08-10 06:27:20 +0900 (Tue, 10 Aug 2010) New Revision: 28942 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=28942 Log: * ext/pathname/pathname.c (path_readlink): Pathname#readlink translated from pathname.rb. Modified files: trunk/ChangeLog trunk/ext/pathname/lib/pathname.rb trunk/ext/pathname/pathname.c Index: ChangeLog =================================================================== --- ChangeLog (revision 28941) +++ ChangeLog (revision 28942) @@ -1,7 +1,12 @@ +Tue Aug 10 06:26:48 2010 Tanaka Akira <akr@f...> + + * ext/pathname/pathname.c (path_readlink): Pathname#readlink translated + from pathname.rb. + Mon Aug 9 22:15:19 2010 Tanaka Akira <akr@f...> - * 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@f...> Index: ext/pathname/lib/pathname.rb =================================================================== --- ext/pathname/lib/pathname.rb (revision 28941) +++ ext/pathname/lib/pathname.rb (revision 28942) @@ -512,9 +512,6 @@ 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 Index: ext/pathname/pathname.c =================================================================== --- ext/pathname/pathname.c (revision 28941) +++ ext/pathname/pathname.c (revision 28942) @@ -356,6 +356,17 @@ } /* + * 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 * * Pathname represents a pathname which locates a file in a filesystem. @@ -567,4 +578,5 @@ 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); } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/