Hi Sean, On 28 Feb 2013, at 23:31, Sean P. DeNigris <sean@clipperadams.com> wrote:
Sven Van Caekenberghe-2 wrote
I am guessing you are lazy and want to type as little as possible
You know me too well ;)
Sven Van Caekenberghe-2 wrote
'http://endpoint.service.com:9090/v1' asZnUrl withPathSegments: '/foo/bar/resource.txt' asZnUrl pathSegments.
I like this one the best for now, as I didn't want to break up the string, to make it easier to change.
Sven Van Caekenberghe-2 wrote
'http://endpoint.service.com:9090/v1' asZnUrl withPathSegments: #(foo bar 'resource.txt').
How about a double dispatch under the covers of withPathSegments:, which does the current behavior for OrderedCollection; and for String, do something like "self findTokens: '/'." and pass that as the argument to withPathSegments:?
I didn't forget about you ;-) So here is what I did in the latest version of Zinc-Resource-Meta (ConfigurationOfZincHTTPComponents project bleedingEdge load): ------ Change the implementation of ZnUrl>>#/ to do a double-dispatch on its argument using #addedToZnUrl: Implemented #addedToZnUrl: on Collection, String and ZnUrl with the added feature that a String is split into path elements on $/ using #findTokens: - Do note that this is an internal path representation, not an encoded external representation. Extended unit tests to cover the new functionality ------ Basically you can now do any of the following: | baseUrl | baseUrl := 'http://api.host.com' asZnUrl. baseUrl / 'doc' / 'file.html'. baseUrl / 'doc/file.html'. baseUrl / #( 'doc' 'file.html' ). baseUrl / 'doc/file.html' asZnUrl. And they are all equivalent, except for the subtle difference noted in the commit message above. What do you think ? Regards, Sven -- Sven Van Caekenberghe http://stfx.eu Smalltalk is the Red Pill