Class: Yast::URLRecodeClass
- Inherits:
-
Module
- Object
- Module
- Yast::URLRecodeClass
- Defined in:
- ../../src/modules/URLRecode.rb
Overview
A drop-in replacement of an earlier Perl implementation
Constant Summary
- USERNAME_PASSWORD_FRAGMENT_SAFE_CHARS =
these will be substituted to a regex character class
"-A-Za-z0-9_.!~*'()"
- PATH_SAFE_CHARS =
"-A-Za-z0-9_.!~*'()/"
- QUERY_SAFE_CHARS =
"-A-Za-z0-9_.!~*'()/:=&"
Instance Method Summary (collapse)
-
- (String) EscapePassword(input)
Escape password, user name and fragment part of URL string.
-
- (String) EscapePath(input)
Escape path part of URL string.
-
- (String) EscapeQuery(input)
Escape path part of URL string.
-
- (String) UnEscape(input)
UnEscape an URL string, replace % sequences by character.
Instance Method Details
- (String) EscapePassword(input)
Escape password, user name and fragment part of URL string
18 19 20 |
# File '../../src/modules/URLRecode.rb', line 18 def EscapePassword(input) escape(input, USERNAME_PASSWORD_FRAGMENT_SAFE_CHARS) end |
- (String) EscapePath(input)
Escape path part of URL string
25 26 27 |
# File '../../src/modules/URLRecode.rb', line 25 def EscapePath(input) escape(input, PATH_SAFE_CHARS) end |
- (String) EscapeQuery(input)
Escape path part of URL string
32 33 34 |
# File '../../src/modules/URLRecode.rb', line 32 def EscapeQuery(input) escape(input, QUERY_SAFE_CHARS) end |
- (String) UnEscape(input)
UnEscape an URL string, replace %<Hexnum><HexNum> sequences by character
40 41 42 |
# File '../../src/modules/URLRecode.rb', line 40 def UnEscape(input) input.gsub(/%([0-9A-Fa-f]{2})/) { Regexp.last_match[1].to_i(16).chr }.force_encoding(input.encoding) end |