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

ruby-changes:17142

From: akr <ko1@a...>
Date: Mon, 30 Aug 2010 07:33:17 +0900 (JST)
Subject: [ruby-changes:17142] Ruby:r29142 (trunk): * ext/pathname/pathname.c (path_.executable_p): Pathname#.executable?

akr	2010-08-30 07:33:09 +0900 (Mon, 30 Aug 2010)

  New Revision: 29142

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

  Log:
    * ext/pathname/pathname.c (path_.executable_p): Pathname#.executable?
      translated from pathname.rb.

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

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 29141)
+++ ChangeLog	(revision 29142)
@@ -1,3 +1,8 @@
+Mon Aug 30 07:32:41 2010  Tanaka Akira  <akr@f...>
+
+	* ext/pathname/pathname.c (path_.executable_p): Pathname#.executable?
+	  translated from pathname.rb.
+
 Sun Aug 29 23:54:10 2010  Nobuyoshi Nakada  <nobu@r...>
 
 	* lib/rdoc/parser/ruby.rb (RDoc#parse_call_parameters): don't
Index: ext/pathname/lib/pathname.rb
===================================================================
--- ext/pathname/lib/pathname.rb	(revision 29141)
+++ ext/pathname/lib/pathname.rb	(revision 29142)
@@ -486,9 +486,6 @@
 
 class Pathname    # * FileTest *
 
-  # See <tt>FileTest.executable?</tt>.
-  def executable?() FileTest.executable?(@path) end
-
   # See <tt>FileTest.executable_real?</tt>.
   def executable_real?() FileTest.executable_real?(@path) end
 
Index: ext/pathname/pathname.c
===================================================================
--- ext/pathname/pathname.c	(revision 29141)
+++ ext/pathname/pathname.c	(revision 29142)
@@ -616,6 +616,15 @@
 }
 
 /*
+ * See <tt>FileTest.executable?</tt>.
+ */
+static VALUE
+path_executable_p(VALUE self)
+{
+    return rb_funcall(rb_mFileTest, rb_intern("executable?"), 1, get_strpath(self));
+}
+
+/*
  * == Pathname
  *
  * Pathname represents a pathname which locates a file in a filesystem.
@@ -846,4 +855,5 @@
     rb_define_method(rb_cPathname, "split", path_split, 0);
     rb_define_method(rb_cPathname, "blockdev?", path_blockdev_p, 0);
     rb_define_method(rb_cPathname, "chardev?", path_chardev_p, 0);
+    rb_define_method(rb_cPathname, "executable?", path_executable_p, 0);
 }

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

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