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

ruby-changes:17169

From: akr <ko1@a...>
Date: Thu, 2 Sep 2010 22:11:20 +0900 (JST)
Subject: [ruby-changes:17169] Ruby:r29168 (trunk): * ext/pathname/pathname.c (path_file_p): Pathname#file?

akr	2010-09-02 22:11:13 +0900 (Thu, 02 Sep 2010)

  New Revision: 29168

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

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

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

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 29167)
+++ ChangeLog	(revision 29168)
@@ -1,3 +1,8 @@
+Thu Sep  2 22:10:38 2010  Tanaka Akira  <akr@f...>
+
+	* ext/pathname/pathname.c (path_file_p): Pathname#file?
+	  translated from pathname.rb.
+
 Thu Sep  2 09:12:02 2010  NAKAMURA Usaku  <usa@r...>
 
 	* win32/win32.c (rb_w32_spawn, rb_w32_aspawn): don't forget to free
Index: ext/pathname/lib/pathname.rb
===================================================================
--- ext/pathname/lib/pathname.rb	(revision 29167)
+++ ext/pathname/lib/pathname.rb	(revision 29168)
@@ -486,9 +486,6 @@
 
 class Pathname    # * FileTest *
 
-  # See <tt>FileTest.file?</tt>.
-  def file?() FileTest.file?(@path) end
-
   # See <tt>FileTest.pipe?</tt>.
   def pipe?() FileTest.pipe?(@path) end
 
Index: ext/pathname/pathname.c
===================================================================
--- ext/pathname/pathname.c	(revision 29167)
+++ ext/pathname/pathname.c	(revision 29168)
@@ -661,6 +661,15 @@
 }
 
 /*
+ * See <tt>FileTest.file?</tt>.
+ */
+static VALUE
+path_file_p(VALUE self)
+{
+    return rb_funcall(rb_mFileTest, rb_intern("file?"), 1, get_strpath(self));
+}
+
+/*
  * == Pathname
  *
  * Pathname represents a pathname which locates a file in a filesystem.
@@ -896,4 +905,5 @@
     rb_define_method(rb_cPathname, "exist?", path_exist_p, 0);
     rb_define_method(rb_cPathname, "grpowned?", path_grpowned_p, 0);
     rb_define_method(rb_cPathname, "directory?", path_directory_p, 0);
+    rb_define_method(rb_cPathname, "file?", path_file_p, 0);
 }

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

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