Class | Eymiha::UrlNormalizer |
In: |
lib/eymiha/url/url_normalizer.rb
|
Parent: | Object |
A UrlNormalizer normalizes URLs. They are validated using the URI class except when they can be identified as file resources. When so, if the designated file‘s name starts with a slash (or a drive identifier followed by a slash on a windows box) the path is used verbatim. If not, the named file is assumed to be relative to a caller-supplied base directory.
relative_base | [R] |
Sets and returns the default directory for normalizing relative file resources. The directory is validated prior to assignment - if invalid a UrlException will be raised.
Returns true if the given relative_base is valid. It should start and end with a slash (or start with a drive designator and a slash and end with a slash on a PC).
Returns an absolute path for the given URL file resource. This is either the incoming URL if absolute, or the URL anchored at the relative base if relative.
Sets and Returns the directory for normalizing relative file resources. The directory is validated prior to assignment - if invalid a UrlException will be raised.