[前][次][番号順一覧][スレッド一覧]

ruby-changes:16895

From: akr <ko1@a...>
Date: Sat, 7 Aug 2010 08:29:25 +0900 (JST)
Subject: [ruby-changes:16895] Ruby:r28891 (trunk): * ext/pathname/pathname.c (path_chown): Pathname#chown translated

akr	2010-08-07 08:27:28 +0900 (Sat, 07 Aug 2010)

  New Revision: 28891

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=28891

  Log:
    * ext/pathname/pathname.c (path_chown): Pathname#chown translated
      from pathname.rb.

  Modified files:
    trunk/ChangeLog
    trunk/ext/pathname/lib/pathname.rb
    trunk/ext/pathname/pathname.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 28890)
+++ ChangeLog	(revision 28891)
@@ -1,3 +1,8 @@
+Sat Aug  7 08:26:26 2010  Tanaka Akira  <akr@f...>
+
+	* ext/pathname/pathname.c (path_chown): Pathname#chown translated
+	  from pathname.rb.
+
 Sat Aug  7 02:09:04 2010  Tanaka Akira  <akr@f...>
 
 	* ext/pathname/pathname.c (path_lchmod): Pathname#lchmod translated
Index: ext/pathname/lib/pathname.rb
===================================================================
--- ext/pathname/lib/pathname.rb	(revision 28890)
+++ ext/pathname/lib/pathname.rb	(revision 28891)
@@ -512,9 +512,6 @@
 
 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
 
Index: ext/pathname/pathname.c
===================================================================
--- ext/pathname/pathname.c	(revision 28890)
+++ ext/pathname/pathname.c	(revision 28891)
@@ -278,6 +278,15 @@
 }
 
 /*
+ * 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 @@
     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);
 }

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]