summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-08-06 12:30:28 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-08-06 12:30:28 +0000
commitc4c4bff456a6f0eb28de0b1e6f6d7bfe4d3e5291 (patch)
treedbab935ecff58e3f37a040575f593f4d8553fd3d
parentcba4d057853fc9d2dfe536a391d191d40cd03180 (diff)
* ext/pathname/pathname.c (path_chmod): Pathname#chmod translated from
pathname.rb. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28888 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 01a0d0e..dbcc4fd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Fri Aug 6 21:30:06 2010 Tanaka Akira <akr@fsij.org>
+
+ * ext/pathname/pathname.c (path_chmod): Pathname#chmod translated from
+ pathname.rb.
+
Fri Aug 6 20:13:42 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
* rational.c (nurat_div): divided by infinity should be zero.
diff --git a/ext/pathname/lib/pathname.rb b/ext/pathname/lib/pathname.rb
index 73aaed5..1f83275 100644
--- a/ext/pathname/lib/pathname.rb
+++ b/ext/pathname/lib/pathname.rb
@@ -512,9 +512,6 @@ end
class Pathname # * File *
- # See <tt>File.chmod</tt>. Changes permissions.
- def chmod(mode) File.chmod(mode, @path) end
-
# See <tt>File.lchmod</tt>.
def lchmod(mode) File.lchmod(mode, @path) end
diff --git a/ext/pathname/pathname.c b/ext/pathname/pathname.c
index a0a2094..1fae923 100644
--- a/ext/pathname/pathname.c
+++ b/ext/pathname/pathname.c
@@ -260,6 +260,15 @@ path_mtime(VALUE self)
}
/*
+ * See <tt>File.chmod</tt>. Changes permissions.
+ */
+static VALUE
+path_chmod(VALUE self, VALUE mode)
+{
+ return rb_funcall(rb_cFile, rb_intern("chmod"), 2, mode, get_strpath(self));
+}
+
+/*
* == Pathname
*
* Pathname represents a pathname which locates a file in a filesystem.
@@ -462,4 +471,5 @@ Init_pathname()
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);
+ rb_define_method(rb_cPathname, "chmod", path_chmod, 1);
}