summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-08-05 20:53:56 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-08-05 20:53:56 +0000
commitdc2676a8a06b2126f7a5abbab9ebbd1f9b4726ce (patch)
treea7ddb51ba6936e06f945d61c07c85beed9df82ad
parent9bf69293e7db531f4ab8d8420b86f3ed627d3b96 (diff)
* ext/pathname/pathname.c (path_mtime): Pathname#mtime translated from
pathname.rb. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28879 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 712b7ba..12b939f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Fri Aug 6 05:53:32 2010 Tanaka Akira <akr@fsij.org>
+
+ * ext/pathname/pathname.c (path_mtime): Pathname#mtime translated from
+ pathname.rb.
+
Thu Aug 5 22:09:30 2010 Tanaka Akira <akr@fsij.org>
* ext/pathname/pathname.c (path_ctime): Pathname#ctime translated from
diff --git a/ext/pathname/lib/pathname.rb b/ext/pathname/lib/pathname.rb
index 907ee11..73aaed5 100644
--- a/ext/pathname/lib/pathname.rb
+++ b/ext/pathname/lib/pathname.rb
@@ -512,9 +512,6 @@ end
class Pathname # * File *
- # See <tt>File.mtime</tt>. Returns last modification time.
- def mtime() File.mtime(@path) end
-
# See <tt>File.chmod</tt>. Changes permissions.
def chmod(mode) File.chmod(mode, @path) end
diff --git a/ext/pathname/pathname.c b/ext/pathname/pathname.c
index e0963ea..a0a2094 100644
--- a/ext/pathname/pathname.c
+++ b/ext/pathname/pathname.c
@@ -251,6 +251,15 @@ path_ctime(VALUE self)
}
/*
+ * See <tt>File.mtime</tt>. Returns last modification time.
+ */
+static VALUE
+path_mtime(VALUE self)
+{
+ return rb_funcall(rb_cFile, rb_intern("mtime"), 1, get_strpath(self));
+}
+
+/*
* == Pathname
*
* Pathname represents a pathname which locates a file in a filesystem.
@@ -452,4 +461,5 @@ Init_pathname()
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);
+ rb_define_method(rb_cPathname, "mtime", path_mtime, 0);
}