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

ruby-changes:16812

From: akr <ko1@a...>
Date: Sat, 31 Jul 2010 16:21:59 +0900 (JST)
Subject: [ruby-changes:16812] Ruby:r28807 (trunk): * ext/pathname/pathname.c (Init_pathname): The alias,

akr	2010-07-31 16:21:42 +0900 (Sat, 31 Jul 2010)

  New Revision: 28807

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

  Log:
    * ext/pathname/pathname.c (Init_pathname): The alias,
      Pathname#to_path, is translated from pathname.rb.

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

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 28806)
+++ ChangeLog	(revision 28807)
@@ -1,3 +1,8 @@
+Sat Jul 31 15:50:03 2010  Tanaka Akira  <akr@f...>
+
+	* ext/pathname/pathname.c (Init_pathname): The alias,
+	  Pathname#to_path, is translated from pathname.rb.
+
 Sat Jul 31 09:12:36 2010  Tanaka Akira  <akr@f...>
 
 	* ext/pathname/pathname.c (path_to_s): Pathname#to_s translated
Index: ext/pathname/lib/pathname.rb
===================================================================
--- ext/pathname/lib/pathname.rb	(revision 28806)
+++ ext/pathname/lib/pathname.rb	(revision 28807)
@@ -31,9 +31,6 @@
 
   # :startdoc:
 
-  # to_path is implemented so Pathname objects are usable with File.open, etc.
-  alias_method TO_PATH, :to_s
-
   def inspect # :nodoc:
     "#<#{self.class}:#{@path}>"
   end
Index: ext/pathname/pathname.c
===================================================================
--- ext/pathname/pathname.c	(revision 28806)
+++ ext/pathname/pathname.c	(revision 28807)
@@ -127,7 +127,13 @@
 }
 
 /*
+ *  call-seq:
+ *    pathname.to_s             => string
+ *    pathname.to_path          => string
+ *
  *  Return the path as a String.
+ *
+ *  to_path is implemented so Pathname objects are usable with File.open, etc.
  */
 static VALUE
 path_to_s(VALUE self)
@@ -329,4 +335,5 @@
     rb_define_method(rb_cPathname, "<=>", path_cmp, 1);
     rb_define_method(rb_cPathname, "hash", path_hash, 0);
     rb_define_method(rb_cPathname, "to_s", path_to_s, 0);
+    rb_define_method(rb_cPathname, "to_path", path_to_s, 0);
 }

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

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