Stefano Crocco
4/1/2007 10:13:00 PM
Alle domenica 1 aprile 2007, Jamal Soueidan ha scritto:
> Thanks, but as I can see there is some methods there:
>
> extract join parse regexp split
>
> what about the attributes which I can access like
>
> url.host or url.port ?
>
> I don't see they mention them on that page?
This is because they're not methods of the URI module, but of classes declared
in it. The URI module knows about several kinds of URIs (from the
documentation, they're http, https, ftp, ldap and mailto). If the string you
pass to URI.parse corresponds to one of these types, then parse returns an
instance of the appropriate class. Otherwise, it will return an instance of
class URI::Generic. To see which classes are availlable, look at the section
Classes and Modules under the module URI documentation. The methods you
mentioned (host, port) are instance methods of these classes. All the classes
used to represent URIs are derived from URI::Generic, so it's likely that
behaviour which doesn't depend on the kind of URI will be there. You should
look under the Methods and the Attributes sections of the documentation page
(for example, host and port are both listed under attributes). If you need to
use something which is specific to a kind of URI, instead, you should look at
the documentation for the class which specifically represents that kind of
URI.
I hope this helps
Stefano