aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--ext/pathname/lib/pathname.rb3
-rw-r--r--ext/pathname/pathname.c10
3 files changed, 15 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index aa6cfb0215..9ddac05695 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Wed Aug 4 06:25:04 2010 Tanaka Akira <akr@fsij.org>
+
+ * ext/pathname/pathname.c (path_atime): Pathname#atime translated from
+ pathname.rb.
+
Tue Aug 3 21:16:03 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
* random.c (Init_Random): add Random::DEFAULT.
diff --git a/ext/pathname/lib/pathname.rb b/ext/pathname/lib/pathname.rb
index a89b740638..1a88d5f603 100644
--- a/ext/pathname/lib/pathname.rb
+++ b/ext/pathname/lib/pathname.rb
@@ -512,9 +512,6 @@ end
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
diff --git a/ext/pathname/pathname.c b/ext/pathname/pathname.c
index d4fd502674..5be73a351b 100644
--- a/ext/pathname/pathname.c
+++ b/ext/pathname/pathname.c
@@ -231,6 +231,15 @@ path_realdirpath(int argc, VALUE *argv, VALUE self)
}
/*
+ * 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 @@ Init_pathname()
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);
}