summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-08-03 21:25:43 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-08-03 21:25:43 +0000
commit88e78ac59b042365a09199aa72488405bcbcad95 (patch)
treeca79f8bf1814d6605c1e62d91ab7e71a1c99c9a0
parent5e9c47c81d986219b1d6c64e4e490179527cd916 (diff)
* ext/pathname/pathname.c (path_atime): Pathname#atime translated from
pathname.rb. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28848 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-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 aa6cfb0..9ddac05 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 a89b740..1a88d5f 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 d4fd502..5be73a3 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);
}