Method: DomainName::Punycode.encode_hostname
- Defined in:
- lib/domain_name/punycode.rb
.encode_hostname(hostname) ⇒ Object
Encode a hostname using IDN/Punycode algorithms
181 182 183 184 185 186 187 188 189 190 191 |
# File 'lib/domain_name/punycode.rb', line 181 def encode_hostname(hostname) hostname.match(RE_NONBASIC) or return hostname hostname.split(DOT).map { |name| if name.match(RE_NONBASIC) PREFIX + encode(name) else name end }.join(DOT) end |