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.

Methods

Attributes

relative_base  [R] 

Public Class methods

grafts on the drive designator for an absolute file if not present and on a pc filesystem

Returns true if the given URL file resource is absolute.

Returns true if the given URL is a file resource.

Creates a new instance using the default direcory for normalizing relative file resources.

Returns the default directory for normalizing relative file resources.

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).

Public Instance methods

Returns a normalized URL relative to the given base if it is a relative file resource.

Normalizes and returns a relative or absolute URL file resource.

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.

[Validate]