From 9bf69293e7db531f4ab8d8420b86f3ed627d3b96 Mon Sep 17 00:00:00 2001 From: akr Date: Thu, 5 Aug 2010 13:09:53 +0000 Subject: * ext/pathname/pathname.c (path_ctime): Pathname#ctime translated from pathname.rb. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28878 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ ext/pathname/lib/pathname.rb | 3 --- ext/pathname/pathname.c | 12 ++++++++++++ 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index fcfffe6825..712b7ba1ea 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Thu Aug 5 22:09:30 2010 Tanaka Akira + + * ext/pathname/pathname.c (path_ctime): Pathname#ctime translated from + pathname.rb. + Thu Aug 5 21:20:31 2010 Yusuke Endoh * compile.c (NODE_ARGSCAT, NODE_ARGSPUSH): drop unused ARGSCAT diff --git a/ext/pathname/lib/pathname.rb b/ext/pathname/lib/pathname.rb index 1a88d5f603..907ee1157a 100644 --- a/ext/pathname/lib/pathname.rb +++ b/ext/pathname/lib/pathname.rb @@ -512,9 +512,6 @@ end class Pathname # * File * - # See File.ctime. Returns last (directory entry, not file) change time. - def ctime() File.ctime(@path) end - # See File.mtime. Returns last modification time. def mtime() File.mtime(@path) end diff --git a/ext/pathname/pathname.c b/ext/pathname/pathname.c index 5be73a351b..e0963eacea 100644 --- a/ext/pathname/pathname.c +++ b/ext/pathname/pathname.c @@ -198,6 +198,8 @@ path_sub_ext(VALUE self, VALUE repl) return rb_class_new_instance(1, &str2, rb_obj_class(self)); } +/* Facade for File */ + /* * Returns the real (absolute) pathname of +self+ in the actual * filesystem not containing symlinks or useless dots. @@ -239,6 +241,15 @@ path_atime(VALUE self) return rb_funcall(rb_cFile, rb_intern("atime"), 1, get_strpath(self)); } +/* + * See File.ctime. Returns last (directory entry, not file) change time. + */ +static VALUE +path_ctime(VALUE self) +{ + return rb_funcall(rb_cFile, rb_intern("ctime"), 1, get_strpath(self)); +} + /* * == Pathname * @@ -440,4 +451,5 @@ Init_pathname() 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); + rb_define_method(rb_cPathname, "ctime", path_ctime, 0); } -- cgit v1.2.3