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.
| 17 18 19 | # File 'lib/seahorse/util.rb', line 17 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
| 24 25 26 | # File 'lib/seahorse/util.rb', line 24 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.
| 9 10 11 | # File 'lib/seahorse/util.rb', line 9 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.
| 13 14 15 | # File 'lib/seahorse/util.rb', line 13 def uri_path_escape(path) path.gsub(/[^\/]+/) { |part| uri_escape(part) } end |