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

ruby-changes:16884

From: akr <ko1@a...>
Date: Fri, 6 Aug 2010 05:54:16 +0900 (JST)
Subject: [ruby-changes:16884] Ruby:r28879 (trunk): * ext/pathname/pathname.c (path_mtime): Pathname#mtime translated from

akr	2010-08-06 05:53:56 +0900 (Fri, 06 Aug 2010)

  New Revision: 28879

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

  Log:
    * ext/pathname/pathname.c (path_mtime): Pathname#mtime translated from
      pathname.rb.

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

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 28878)
+++ ChangeLog	(revision 28879)
@@ -1,3 +1,8 @@
+Fri Aug  6 05:53:32 2010  Tanaka Akira  <akr@f...>
+
+	* ext/pathname/pathname.c (path_mtime): Pathname#mtime translated from
+	  pathname.rb.
+
 Thu Aug  5 22:09:30 2010  Tanaka Akira  <akr@f...>
 
 	* ext/pathname/pathname.c (path_ctime): Pathname#ctime translated from
Index: ext/pathname/lib/pathname.rb
===================================================================
--- ext/pathname/lib/pathname.rb	(revision 28878)
+++ ext/pathname/lib/pathname.rb	(revision 28879)
@@ -512,9 +512,6 @@
 
 class Pathname    # * File *
 
-  # See <tt>File.mtime</tt>.  Returns last modification time.
-  def mtime() File.mtime(@path) end
-
   # See <tt>File.chmod</tt>.  Changes permissions.
   def chmod(mode) File.chmod(mode, @path) end
 
Index: ext/pathname/pathname.c
===================================================================
--- ext/pathname/pathname.c	(revision 28878)
+++ ext/pathname/pathname.c	(revision 28879)
@@ -251,6 +251,15 @@
 }
 
 /*
+ * See <tt>File.mtime</tt>.  Returns last modification time.
+ */
+static VALUE
+path_mtime(VALUE self)
+{
+    return rb_funcall(rb_cFile, rb_intern("mtime"), 1, get_strpath(self));
+}
+
+/*
  * == Pathname
  *
  * Pathname represents a pathname which locates a file in a filesystem.
@@ -452,4 +461,5 @@
     rb_define_method(rb_cPathname, "realdirpath", path_realdirpath, -1);
     rb_define_method(rb_cPathname, "atime", path_atime, 0);
     rb_define_method(rb_cPathname, "ctime", path_ctime, 0);
+    rb_define_method(rb_cPathname, "mtime", path_mtime, 0);
 }

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

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