Module: Tilia::Http::UrlUtil

Defined in:
lib/tilia/http/url_util.rb

Overview

URL utility class

Note: this class is deprecated. All its functionality moved to functions.php or sabreuri.

Class Method Summary collapse

Class Method Details

.decode_path(path) ⇒ String

Deprecated.

use SabreHTTPdecodePath

Decodes a url-encoded path

Parameters:

  • path (String)

Returns:

  • (String)


37
38
39
# File 'lib/tilia/http/url_util.rb', line 37

def self.decode_path(path)
  Tilia::Http.decode_path(path)
end

.decode_path_segment(path) ⇒ String

Deprecated.

use SabreHTTPdecode_path_segment

Decodes a url-encoded path segment

Parameters:

  • path (String)

Returns:

  • (String)


46
47
48
# File 'lib/tilia/http/url_util.rb', line 46

def self.decode_path_segment(path)
  Tilia::Http.decode_path_segment(path)
end

.encode_path(path) ⇒ String

Deprecated.

use SabreHTTPencode_path

Encodes the path of a url.

slashes (/) are treated as path-separators.

Parameters:

  • path (String)

Returns:

  • (String)


17
18
19
# File 'lib/tilia/http/url_util.rb', line 17

def self.encode_path(path)
  Tilia::Http.encode_path(path)
end

.encode_path_segment(path_segment) ⇒ String

Deprecated.

use SabreHTTPencode_path_segment

Encodes a 1 segment of a path

Slashes are considered part of the name, and are encoded as %2f

Parameters:

  • path_segment (String)

Returns:

  • (String)


28
29
30
# File 'lib/tilia/http/url_util.rb', line 28

def self.encode_path_segment(path_segment)
  Tilia::Http.encode_path_segment(path_segment)
end

.resolve(base_path, new_path) ⇒ String

Deprecated.

Use SabreUriresolve.

Resolves relative urls, like a browser would.

Parameters:

  • base_path (String)
  • new_path (String)

Returns:

  • (String)


65
66
67
# File 'lib/tilia/http/url_util.rb', line 65

def self.resolve(base_path, new_path)
  Tilia::Uri.resolve(base_path, new_path)
end

.split_path(path) ⇒ Object

Deprecated.

Use SabreUrisplit.

Returns the ‘dirname’ and ‘basename’ for a path.

Parameters:

  • path (String)

Returns:

  • array



55
56
57
# File 'lib/tilia/http/url_util.rb', line 55

def self.split_path(path)
  Tilia::Uri.split(path)
end