Module: Seahorse::Util Private
- Defined in:
- lib/seahorse/util.rb
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Class Method Summary collapse
- .escape_header_list_string(s) ⇒ Object private
-
.host_label?(str) ⇒ Boolean
private
Checks for a valid host label.
- .uri_escape(string) ⇒ Object private
- .uri_path_escape(path) ⇒ Object private
Class Method Details
.escape_header_list_string(s) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
18 19 20 |
# File 'lib/seahorse/util.rb', line 18 def escape_header_list_string(s) s.include?('"') || s.include?(',') ? "\"#{s.gsub('"', '\"')}\"" : s end |
.host_label?(str) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Checks for a valid host label
25 26 27 |
# File 'lib/seahorse/util.rb', line 25 def host_label?(str) str =~ /^(?!-)[a-zA-Z0-9-]{1,63}(?<!-)$/ end |
.uri_escape(string) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
10 11 12 |
# File 'lib/seahorse/util.rb', line 10 def uri_escape(string) CGI.escape(string.to_s.encode('UTF-8')).gsub('+', '%20').gsub('%7E', '~') end |
.uri_path_escape(path) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
14 15 16 |
# File 'lib/seahorse/util.rb', line 14 def uri_path_escape(path) path.gsub(/[^\/]+/) { |part| uri_escape(part) } end |