diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-08-05 13:09:53 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-08-05 13:09:53 +0000 |
commit | 9bf69293e7db531f4ab8d8420b86f3ed627d3b96 (patch) | |
tree | b38bc983853e96f98d887612e388cc23ad4823ee /ext/pathname | |
parent | 5ffe59faf8ad8f3ccfa39ec1d0d1791dfc02ac55 (diff) | |
download | ruby-9bf69293e7db531f4ab8d8420b86f3ed627d3b96.tar.gz |
* 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
Diffstat (limited to 'ext/pathname')
-rw-r--r-- | ext/pathname/lib/pathname.rb | 3 | ||||
-rw-r--r-- | ext/pathname/pathname.c | 12 |
2 files changed, 12 insertions, 3 deletions
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 <tt>File.ctime</tt>. Returns last (directory entry, not file) change time. - def ctime() File.ctime(@path) end - # See <tt>File.mtime</tt>. 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. @@ -240,6 +242,15 @@ path_atime(VALUE self) } /* + * See <tt>File.ctime</tt>. 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 * * Pathname represents a pathname which locates a file in a filesystem. @@ -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); } |