aboutsummaryrefslogtreecommitdiffstats
path: root/ext/pathname
diff options
context:
space:
mode:
Diffstat (limited to 'ext/pathname')
-rw-r--r--ext/pathname/lib/pathname.rb3
-rw-r--r--ext/pathname/pathname.c10
2 files changed, 10 insertions, 3 deletions
diff --git a/ext/pathname/lib/pathname.rb b/ext/pathname/lib/pathname.rb
index d1a7b5c856..baadec4196 100644
--- a/ext/pathname/lib/pathname.rb
+++ b/ext/pathname/lib/pathname.rb
@@ -512,9 +512,6 @@ end
class Pathname # * File *
- # See <tt>File.utime</tt>. Update the access and modification times.
- def utime(atime, mtime) File.utime(atime, mtime, @path) end
-
# See <tt>File.basename</tt>. Returns the last component of the path.
def basename(*args) self.class.new(File.basename(@path, *args)) end
diff --git a/ext/pathname/pathname.c b/ext/pathname/pathname.c
index a1d260f3ad..ca7377c85a 100644
--- a/ext/pathname/pathname.c
+++ b/ext/pathname/pathname.c
@@ -415,6 +415,15 @@ path_truncate(VALUE self, VALUE length)
}
/*
+ * See <tt>File.utime</tt>. Update the access and modification times.
+ */
+static VALUE
+path_utime(VALUE self, VALUE atime, VALUE mtime)
+{
+ return rb_funcall(rb_cFile, rb_intern("utime"), 3, atime, mtime, get_strpath(self));
+}
+
+/*
* == Pathname
*
* Pathname represents a pathname which locates a file in a filesystem.
@@ -632,4 +641,5 @@ Init_pathname()
rb_define_method(rb_cPathname, "lstat", path_lstat, 0);
rb_define_method(rb_cPathname, "make_symlink", path_make_symlink, 1);
rb_define_method(rb_cPathname, "truncate", path_truncate, 1);
+ rb_define_method(rb_cPathname, "utime", path_utime, 2);
}