diff --git a/Foundation/CPArray.j b/Foundation/CPArray.j
index c57ecb99f..8fec1956c 100755
--- a/Foundation/CPArray.j
+++ b/Foundation/CPArray.j
@@ -656,21 +656,16 @@ import "CPException.j"
/*
Returns a string formed by concatenating the objects in the
receiver, with the specified separator string inserted between each part.
- If the element is a Cappuccino object, then the description
+ If the element is a Objective-J object, then the description
of that object will be used, otherwise the default JavaScript representation will be used.
@param aString the separator that will separate each object string
@return the string representation of the array
*/
- (CPString)componentsJoinedByString:(CPString)aString
{
- var index = 0,
- count = [self count],
- string = @"";
-
- for(; index < count; ++i)
- string += self[index].isa ? [self[index] description] : self[index];
-
- return string;
+ // Objective-J objects get "description" called on them automatically when coerced to strings
+ // (see "objj_object.prototype.toString" at bottom of CPObject.j)
+ return join(aString);
}
// Creating a description of the array
diff --git a/Foundation/CPLog.j b/Foundation/CPLog.j
index baea2eed1..77000967f 100644
--- a/Foundation/CPLog.j
+++ b/Foundation/CPLog.j
@@ -372,12 +372,3 @@ var _CPLogInitPopup = function(logWindow)
}
}, false);
}
-
-// override toString on Objective-J objects so we print the actual description of the object instead of [Object object]
-objj_object.prototype.toString = function()
-{
- if (this.isa && class_getInstanceMethod(this.isa, "description") != NULL)
- return [this description]
- else
- return String(this) + " (-description not implemented)";
-}
diff --git a/Foundation/CPObject.j b/Foundation/CPObject.j
index 7bae52908..be44363ee 100644
--- a/Foundation/CPObject.j
+++ b/Foundation/CPObject.j
@@ -453,3 +453,13 @@
}
@end
+
+// override toString on Objective-J objects so we get the actual description of the object
+// when coerced to a string, instead of "[Object object]"
+objj_object.prototype.toString = function()
+{
+ if (this.isa && class_getInstanceMethod(this.isa, "description") != NULL)
+ return [this description]
+ else
+ return String(this) + " (-description not implemented)";
+}