summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-08-06 23:27:28 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-08-06 23:27:28 +0000
commit261bb184c61b8d881a60c39efba3580472bfbc36 (patch)
tree8e6e73464e666d26fc436dcaf53a88d60ff6fa2e /ext
parenta1d1c102d727d9f51837068ae15a45fdfe396532 (diff)
* ext/pathname/pathname.c (path_chown): Pathname#chown translated
from pathname.rb. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28891 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-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 7e3d453e66..ad51ed70f5 100644
--- a/ext/pathname/lib/pathname.rb
+++ b/ext/pathname/lib/pathname.rb
@@ -512,9 +512,6 @@ end
class Pathname # * File *
- # See <tt>File.chown</tt>. Change owner and group of file.
- def chown(owner, group) File.chown(owner, group, @path) end
-
# See <tt>File.lchown</tt>.
def lchown(owner, group) File.lchown(owner, group, @path) end
diff --git a/ext/pathname/pathname.c b/ext/pathname/pathname.c
index 0a3b6771c4..a32c1fdeca 100644
--- a/ext/pathname/pathname.c
+++ b/ext/pathname/pathname.c
@@ -278,6 +278,15 @@ path_lchmod(VALUE self, VALUE mode)
}
/*
+ * See <tt>File.chown</tt>. Change owner and group of file.
+ */
+static VALUE
+path_chown(VALUE self, VALUE owner, VALUE group)
+{
+ return rb_funcall(rb_cFile, rb_intern("chown"), 3, owner, group, get_strpath(self));
+}
+
+/*
* == Pathname
*
* Pathname represents a pathname which locates a file in a filesystem.
@@ -482,4 +491,5 @@ Init_pathname()
rb_define_method(rb_cPathname, "mtime", path_mtime, 0);
rb_define_method(rb_cPathname, "chmod", path_chmod, 1);
rb_define_method(rb_cPathname, "lchmod", path_lchmod, 1);
+ rb_define_method(rb_cPathname, "chown", path_chown, 1);
}