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

ruby-changes:17232

From: akr <ko1@a...>
Date: Sun, 12 Sep 2010 09:26:25 +0900 (JST)
Subject: [ruby-changes:17232] Ruby:r29232 (trunk): * ext/pathname/pathname.c (path_writable_p): Pathname#writable?

akr	2010-09-12 09:26:19 +0900 (Sun, 12 Sep 2010)

  New Revision: 29232

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

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

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

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 29231)
+++ ChangeLog	(revision 29232)
@@ -1,3 +1,8 @@
+Sun Sep 12 09:16:06 2010  Tanaka Akira  <akr@f...>
+
+	* ext/pathname/pathname.c (path_writable_p): Pathname#writable?
+	  translated from pathname.rb.
+
 Sun Sep 12 08:36:15 2010  Tanaka Akira  <akr@f...>
 
 	* process.c (rlimit_resource_name2int): support more limits:
Index: ext/pathname/lib/pathname.rb
===================================================================
--- ext/pathname/lib/pathname.rb	(revision 29231)
+++ ext/pathname/lib/pathname.rb	(revision 29232)
@@ -486,9 +486,6 @@
 
 class Pathname    # * FileTest *
 
-  # See <tt>FileTest.writable?</tt>.
-  def writable?() FileTest.writable?(@path) end
-
   # See <tt>FileTest.world_writable?</tt>.
   def world_writable?() FileTest.world_writable?(@path) end
 
Index: ext/pathname/pathname.c
===================================================================
--- ext/pathname/pathname.c	(revision 29231)
+++ ext/pathname/pathname.c	(revision 29232)
@@ -778,6 +778,15 @@
 }
 
 /*
+ * See <tt>FileTest.writable?</tt>.
+ */
+static VALUE
+path_writable_p(VALUE self)
+{
+    return rb_funcall(rb_mFileTest, rb_intern("writable?"), 1, get_strpath(self));
+}
+
+/*
  * == Pathname
  *
  * Pathname represents a pathname which locates a file in a filesystem.
@@ -1026,4 +1035,5 @@
     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);
+    rb_define_method(rb_cPathname, "writable?", path_writable_p, 0);
 }

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

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