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

Class Method Details

.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


20
21
22
# File 'lib/seahorse/util.rb', line 20

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