[前][次][番号順一覧][スレッド一覧]

ruby-changes:17221

From: akr <ko1@a...>
Date: Sat, 11 Sep 2010 07:37:25 +0900 (JST)
Subject: [ruby-changes:17221] Ruby:r29220 (trunk): * ext/pathname/pathname.c (path_symlink_p): Pathname#symlink?

akr	2010-09-11 06:54:24 +0900 (Sat, 11 Sep 2010)

  New Revision: 29220

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=29220

  Log:
    * ext/pathname/pathname.c (path_symlink_p): Pathname#symlink?
      translated from pathname.rb.

  Modified files:
    trunk/ChangeLog
    trunk/ext/pathname/lib/pathname.rb
    trunk/ext/pathname/pathname.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 29219)
+++ ChangeLog	(revision 29220)
@@ -1,3 +1,8 @@
+Sat Sep 11 06:53:12 2010  Tanaka Akira  <akr@f...>
+
+	* ext/pathname/pathname.c (path_symlink_p): Pathname#symlink?
+	  translated from pathname.rb.
+
 Fri Sep 10 23:03:43 2010  Tanaka Akira  <akr@f...>
 
 	* ext/pathname/pathname.c (path_sticky_p): Pathname#sticky? translated
Index: ext/pathname/lib/pathname.rb
===================================================================
--- ext/pathname/lib/pathname.rb	(revision 29219)
+++ ext/pathname/lib/pathname.rb	(revision 29220)
@@ -486,9 +486,6 @@
 
 class Pathname    # * FileTest *
 
-  # See <tt>FileTest.symlink?</tt>.
-  def symlink?() FileTest.symlink?(@path) end
-
   # See <tt>FileTest.writable?</tt>.
   def writable?() FileTest.writable?(@path) end
 
Index: ext/pathname/pathname.c
===================================================================
--- ext/pathname/pathname.c	(revision 29219)
+++ ext/pathname/pathname.c	(revision 29220)
@@ -769,6 +769,15 @@
 }
 
 /*
+ * See <tt>FileTest.symlink?</tt>.
+ */
+static VALUE
+path_symlink_p(VALUE self)
+{
+    return rb_funcall(rb_mFileTest, rb_intern("symlink?"), 1, get_strpath(self));
+}
+
+/*
  * == Pathname
  *
  * Pathname represents a pathname which locates a file in a filesystem.
@@ -1016,4 +1025,5 @@
     rb_define_method(rb_cPathname, "size", path_size, 0);
     rb_define_method(rb_cPathname, "size?", path_size_p, 0);
     rb_define_method(rb_cPathname, "sticky?", path_sticky_p, 0);
+    rb_define_method(rb_cPathname, "symlink?", path_symlink_p, 0);
 }

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]