summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-08-05 13:09:53 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-08-05 13:09:53 +0000
commit9bf69293e7db531f4ab8d8420b86f3ed627d3b96 (patch)
treeb38bc983853e96f98d887612e388cc23ad4823ee
parent5ffe59faf8ad8f3ccfa39ec1d0d1791dfc02ac55 (diff)
* 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
-rw-r--r--ChangeLog5
-rw-r--r--ext/pathname/lib/pathname.rb3
-rw-r--r--ext/pathname/pathname.c12
3 files changed, 17 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index fcfffe6..712b7ba 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Thu Aug 5 22:09:30 2010 Tanaka Akira <akr@fsij.org>
+
+ * ext/pathname/pathname.c (path_ctime): Pathname#ctime translated from
+ pathname.rb.
+
Thu Aug 5 21:20:31 2010 Yusuke Endoh <mame@tsg.ne.jp>
* compile.c (NODE_ARGSCAT, NODE_ARGSPUSH): drop unused ARGSCAT
diff --git a/ext/pathname/lib/pathname.rb b/ext/pathname/lib/pathname.rb
index 1a88d5f..907ee11 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 5be73a3..e0963ea 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);
}