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

ruby-changes:16810

From: akr <ko1@a...>
Date: Sat, 31 Jul 2010 09:16:45 +0900 (JST)
Subject: [ruby-changes:16810] Ruby:r28805 (trunk): * ext/pathname/pathname.c (path_to_s): Pathname#to_s translated

akr	2010-07-31 09:13:10 +0900 (Sat, 31 Jul 2010)

  New Revision: 28805

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

  Log:
    * ext/pathname/pathname.c (path_to_s): Pathname#to_s translated
      from pathname.rb.

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

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 28804)
+++ ChangeLog	(revision 28805)
@@ -1,3 +1,8 @@
+Sat Jul 31 09:12:36 2010  Tanaka Akira  <akr@f...>
+
+	* ext/pathname/pathname.c (path_to_s): Pathname#to_s translated
+	  from pathname.rb.
+
 Sat Jul 31 08:20:07 2010  NAKAMURA, Hiroshi  <nahi@r...>
 
 	* lib/webrick/ssl.rb (WEBrick::Utils.create_self_signed_cert):
Index: ext/pathname/lib/pathname.rb
===================================================================
--- ext/pathname/lib/pathname.rb	(revision 28804)
+++ ext/pathname/lib/pathname.rb	(revision 28805)
@@ -31,11 +31,6 @@
 
   # :startdoc:
 
-  # Return the path as a String.
-  def to_s
-    @path.dup
-  end
-
   # to_path is implemented so Pathname objects are usable with File.open, etc.
   alias_method TO_PATH, :to_s
 
Index: ext/pathname/pathname.c
===================================================================
--- ext/pathname/pathname.c	(revision 28804)
+++ ext/pathname/pathname.c	(revision 28805)
@@ -127,6 +127,15 @@
 }
 
 /*
+ *  Return the path as a String.
+ */
+static VALUE
+path_to_s(VALUE self)
+{
+    return rb_obj_dup(get_strpath(self));
+}
+
+/*
  * == Pathname
  *
  * Pathname represents a pathname which locates a file in a filesystem.
@@ -319,4 +328,5 @@
     rb_define_method(rb_cPathname, "eql?", path_eq, 1);
     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);
 }

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

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