So, okay, guys. I’m trying to get better about this release early/often
Here is what I made today:
== WHAT IS IT?
uri-relative is a small gem which embellishes URI::Generic with a few
useful methods: URI::Generic#normalize (and normalize!),
URI::Generic#resolve, and URI::Generic#relativize.
normalize compresses those /./ and /…/ bits in your paths
resolve uses one URI as reference to convert another URI
from relative to absolute (per RFC 2396)
relativize will do the reverse, taking a URI from absolute
to relative (per… Java-URI I guess)
Keen Java-ists may note a certain similarity to what’s offered by Java’s
URI class. It’s not entirely accidental. But mainly I just needed to
do some of that same sort of URI manipulation in Ruby and nobody could
point me to any libraries to do it.
All pyramids look alike.
== IS IT DONE YET?
Well, I think the coding part is basically done. I just need to
implement URI::Generic#relativize and write documentation.
== WHERE DO I GET IT?
I’ll have a rubyforge project set up sooner or later. Like, after I
In the meantime, there is a tiny embittered stump of a website here:
But really I would only bother with the gem and/or tarball:
Hah! Well, I feel dumb. URI::Generic#merge and URI::Generic#route_to
do precisely the same thing as my own methods. And they’re the
practically the only rdoc’d methods in URI::Generic, too. Should have
stuck out like a sore thumb.
So … that leaves URI::Generic#normalize, I think. Anyone have a use
Briefly, I’ve dropped my own resolution and relativization methods in
favor of the existing ones in URI::Generic. So, uri-relative is now
simply a library that adds a Java-esque ‘normalize’ method and some
aliases to Ruby’s URI::Generic.
The project page (such as it is) is here:
Are there any other useful things which are actually missing? Or have I
also missed some obvious way to do normalization with stock
(By the way: here’s the funny part: I was actually calling
URI::Generic#merge as part of my URI::Generic#resolve, without realizing
its full functionality! I suppose that at least I can say that
implementing my own resolve and relativize methods was a useful learning