From 88e78ac59b042365a09199aa72488405bcbcad95 Mon Sep 17 00:00:00 2001 From: akr Date: Tue, 3 Aug 2010 21:25:43 +0000 Subject: * 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 --- ext/pathname/lib/pathname.rb | 3 --- ext/pathname/pathname.c | 10 ++++++++++ 2 files changed, 10 insertions(+), 3 deletions(-) (limited to 'ext') 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 File.atime. Returns last access time. - def atime() File.atime(@path) end - # See File.ctime. 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 @@ -230,6 +230,15 @@ path_realdirpath(int argc, VALUE *argv, VALUE self) return rb_class_new_instance(1, &str, rb_obj_class(self)); } +/* + * See File.atime. Returns last access time. + */ +static VALUE +path_atime(VALUE self) +{ + return rb_funcall(rb_cFile, rb_intern("atime"), 1, get_strpath(self)); +} + /* * == Pathname * @@ -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); } -- cgit v1.2.3