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

ruby-changes:16853

From: akr <ko1@a...>
Date: Wed, 4 Aug 2010 06:26:41 +0900 (JST)
Subject: [ruby-changes:16853] Ruby:r28848 (trunk): * ext/pathname/pathname.c (path_atime): Pathname#atime translated from

akr	2010-08-04 06:25:43 +0900 (Wed, 04 Aug 2010)

  New Revision: 28848

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

  Log:
    * ext/pathname/pathname.c (path_atime): Pathname#atime translated from
      pathname.rb.

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

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 28847)
+++ ChangeLog	(revision 28848)
@@ -1,3 +1,8 @@
+Wed Aug  4 06:25:04 2010  Tanaka Akira  <akr@f...>
+
+	* ext/pathname/pathname.c (path_atime): Pathname#atime translated from
+	  pathname.rb.
+
 Tue Aug  3 21:16:03 2010  Nobuyoshi Nakada  <nobu@r...>
 
 	* random.c (Init_Random): add Random::DEFAULT.
Index: ext/pathname/lib/pathname.rb
===================================================================
--- ext/pathname/lib/pathname.rb	(revision 28847)
+++ ext/pathname/lib/pathname.rb	(revision 28848)
@@ -512,9 +512,6 @@
 
 class Pathname    # * File *
 
-  # See <tt>File.atime</tt>.  Returns last access time.
-  def atime() File.atime(@path) end
-
   # See <tt>File.ctime</tt>.  Returns last (directory entry, not file) change time.
   def ctime() File.ctime(@path) end
 
Index: ext/pathname/pathname.c
===================================================================
--- ext/pathname/pathname.c	(revision 28847)
+++ ext/pathname/pathname.c	(revision 28848)
@@ -231,6 +231,15 @@
 }
 
 /*
+ * See <tt>File.atime</tt>.  Returns last access time.
+ */
+static VALUE
+path_atime(VALUE self)
+{
+    return rb_funcall(rb_cFile, rb_intern("atime"), 1, get_strpath(self));
+}
+
+/*
  * == Pathname
  *
  * Pathname represents a pathname which locates a file in a filesystem.
@@ -430,4 +439,5 @@
     rb_define_method(rb_cPathname, "sub_ext", path_sub_ext, 1);
     rb_define_method(rb_cPathname, "realpath", path_realpath, -1);
     rb_define_method(rb_cPathname, "realdirpath", path_realdirpath, -1);
+    rb_define_method(rb_cPathname, "atime", path_atime, 0);
 }

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

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