Merge: Apply optional params in strip_extension, basename and join
authorJean Privat <jean@pryen.org>
Mon, 20 Jul 2015 13:33:45 +0000 (09:33 -0400)
committerJean Privat <jean@pryen.org>
Mon, 20 Jul 2015 13:33:45 +0000 (09:33 -0400)
commitdb4a99074185f4abcbd8aafd7952308ca060eb34
treeb5f86aaab4a0bd001b2bae35204d33449e2c3a42
parent935baefde939cc7e64e164c3c036b6669788ab5c
parent2039bb5b644ce6eda439e01b7bf85c1e6f0862f1
Merge: Apply optional params in strip_extension, basename and join

Using optional parameters, the methods `strip_extension`, `basename` and `join` have a default behavior that fit most usage.

* `Collection::join` appends all elements of the collection by default, the same as `join("")`. This is the old behavior of `Collection::to_s`.

* `String::strip_extension` removes the rightmost extension by default, the same as `s.strip_extension("." + s.file_extension)`.

* `String::basename` does not strip the extension by default.

I haven't updated any users of `strip_extension` because the default behavior requires more work. Thus changing the already existing calls to something else would slow down the programs by a very small margin.

Pull-Request: #1575
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
Reviewed-by: Jean Privat <jean@pryen.org>