[#5563] Non-overridable and non-redefinable methods — Eric Mahurin <eric_mahurin@...>

Lately, I've been thinking about the future of ruby

44 messages 2005/08/19
[#5564] Re: Non-overridable and non-redefinable methods — Austin Ziegler <halostatue@...> 2005/08/19

On 8/19/05, Eric Mahurin <eric_mahurin@yahoo.com> wrote:

[#5571] Re: Non-overridable and non-redefinable methods — Eric Mahurin <eric_mahurin@...> 2005/08/19

--- Austin Ziegler <halostatue@gmail.com> wrote:

[#5574] Re: Non-overridable and non-redefinable methods — TRANS <transfire@...> 2005/08/20

Just wanted to add a few things.

[#5581] Re: Non-overridable and non-redefinable methods — Austin Ziegler <halostatue@...> 2005/08/20

On 8/19/05, TRANS <transfire@gmail.com> wrote:

[#5583] Re: Non-overridable and non-redefinable methods — "David A. Black" <dblack@...> 2005/08/20

Hi --

[#5585] Re: Non-overridable and non-redefinable methods — Eric Mahurin <eric_mahurin@...> 2005/08/20

--- "David A. Black" <dblack@wobblini.net> wrote:

[#5609] Pathname#walk for traversing path nodes (patch) — ES <ruby-ml@...>

Here is a small addition to Pathname against 1.9, probably suited

20 messages 2005/08/22

Re: File.join edge cases

From: nobu.nokada@...
Date: 2005-08-29 22:47:01 UTC
List: ruby-core #5708
Hi,

At Tue, 30 Aug 2005 05:57:16 +0900,
Daniel Berger wrote in [ruby-core:05706]:
> I'm surprised that File.join stringifies all of its arguments.  May I ask why 
> that approach was taken?

Originally, it was just a wrapper for
  [*pathes].join(File::SEPARATOR)


Index: file.c
===================================================================
RCS file: /cvs/ruby/src/ruby/file.c,v
retrieving revision 1.200
diff -U2 -p -r1.200 file.c
--- file.c	30 Jun 2005 06:20:08 -0000	1.200
+++ file.c	29 Aug 2005 22:43:26 -0000
@@ -2822,4 +2822,5 @@ file_inspect_join(ary, arg, recur)
     VALUE ary;
     VALUE *arg;
+    int recur;
 {
     if (recur) return rb_str_new2("[...]");
@@ -2834,5 +2835,5 @@ rb_file_join(ary, sep)
     int taint = 0;
     VALUE result, tmp;
-    char *name;
+    char *name, *tail;
 
     if (RARRAY(ary)->len == 0) return rb_str_new(0, 0);
@@ -2868,9 +2869,16 @@ rb_file_join(ary, sep)
 	    break;
 	  default:
-	    tmp = rb_obj_as_string(tmp);
+	    StringValueCStr(tmp);
 	}
 	name = StringValueCStr(result);
-	if (i > 0 && !NIL_P(sep) && !*chompdirsep(name))
-	    rb_str_buf_append(result, sep);
+	if (i > 0 && !NIL_P(sep)) {
+	    tail = chompdirsep(name);
+	    if (isdirsep(RSTRING(tmp)->ptr[0])) {
+		RSTRING(result)->len = tail - name;
+	    }
+	    else if (!*tail) {
+		rb_str_buf_append(result, sep);
+	    }
+	}
 	rb_str_buf_append(result, tmp);
 	if (OBJ_TAINTED(tmp)) taint = 1;


-- 
Nobu Nakada

In This Thread