+ Helpers#URL

why the lucky stiff
2006-02-13T21:12:05Z

Okay, a new method: Helpers#URL.  Here''s the rundown.

== Helpers#URL =
Builds a complete URL to a controller route or a path, returning a URI
object.  Basically, an absolute URL which can replace the ugly `self /
R(...)` in your controllers.

Assuming the Hoodwink.d app is mounted at
http://localhost:3301/hoodwinkd/, in a controller or view you''ll see
the
following results:

  URL()
     #=> #<URI::HTTP URL:http://localhost:3301/hoodwinkd/>
  self.URL
     #=> #<URI::HTTP URL:http://localhost:3301/hoodwinkd/>
  URL(Static, ''js/prototype.js'')
     #=> #<URI::HTTP
URL:http://localhost:3301/hoodwinkd/static/js/prototype.js>
  URL("/boingboing.net/setup")
     #=> #<URI::HTTP
URL:http://localhost:3301/hoodwinkd/boingboing.net/setup>
  URL("http://google.com")
     #=> #<URI::HTTP URL:http://google.com/>

Since a URI object is returned, you can also get host-local absolute
paths by calling URL(...).path.

_why