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

ruby-changes:16907

From: akr <ko1@a...>
Date: Sat, 7 Aug 2010 18:21:59 +0900 (JST)
Subject: [ruby-changes:16907] Ruby:r28903 (trunk): * ext/pathname/pathname.c (path_lchown): Pathname#lchown translated

akr	2010-08-07 18:21:37 +0900 (Sat, 07 Aug 2010)

  New Revision: 28903

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

  Log:
    * ext/pathname/pathname.c (path_lchown): Pathname#lchown translated
      from pathname.rb.

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

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 28902)
+++ ChangeLog	(revision 28903)
@@ -1,3 +1,8 @@
+Sat Aug  7 18:20:41 2010  Tanaka Akira  <akr@f...>
+
+	* ext/pathname/pathname.c (path_lchown): Pathname#lchown translated
+	  from pathname.rb.
+
 Sat Aug  7 17:49:10 2010  Nobuyoshi Nakada  <nobu@r...>
 
 	* include/ruby/missing.h: moved BROKEN_CLOSE replacements from
Index: ext/pathname/lib/pathname.rb
===================================================================
--- ext/pathname/lib/pathname.rb	(revision 28902)
+++ ext/pathname/lib/pathname.rb	(revision 28903)
@@ -512,9 +512,6 @@
 
 class Pathname    # * File *
 
-  # See <tt>File.lchown</tt>.
-  def lchown(owner, group) File.lchown(owner, group, @path) end
-
   # See <tt>File.fnmatch</tt>.  Return +true+ if the receiver matches the given
   # pattern.
   def fnmatch(pattern, *args) File.fnmatch(pattern, @path, *args) end
Index: ext/pathname/pathname.c
===================================================================
--- ext/pathname/pathname.c	(revision 28902)
+++ ext/pathname/pathname.c	(revision 28903)
@@ -287,6 +287,15 @@
 }
 
 /*
+ * See <tt>File.lchown</tt>.
+ */
+static VALUE
+path_lchown(VALUE self, VALUE owner, VALUE group)
+{
+    return rb_funcall(rb_cFile, rb_intern("lchown"), 3, owner, group, get_strpath(self));
+}
+
+/*
  * == Pathname
  *
  * Pathname represents a pathname which locates a file in a filesystem.
@@ -492,4 +501,5 @@
     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, 2);
+    rb_define_method(rb_cPathname, "lchown", path_lchown, 2);
 }
Index: test/pathname/test_pathname.rb
===================================================================
--- test/pathname/test_pathname.rb	(revision 28902)
+++ test/pathname/test_pathname.rb	(revision 28903)
@@ -738,7 +738,6 @@
       File.symlink("a", "l")
       path = Pathname("l")
       old = path.lstat.mode
-      assert_normal_exit %{ require "pathname"; Pathname("foo").lchmod(nil) }
       begin
         path.lchmod(0444)
       rescue NotImplementedError

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

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