module Seahorse::Util

@api private

Public Class Methods

host_label?(str) click to toggle source

Checks for a valid host label @see tools.ietf.org/html/rfc3986#section-3.2.2 @see tools.ietf.org/html/rfc1123#page-13

# File lib/seahorse/util.rb, line 20
def host_label?(str)
  str =~ /^(?!-)[a-zA-Z0-9-]{1,63}(?<!-)$/
end
uri_escape(string) click to toggle source
# 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) click to toggle source
# File lib/seahorse/util.rb, line 13
def uri_path_escape(path)
  path.gsub(/[^\/]+/) { |part| uri_escape(part) }
end