Class DomainName
In: lib/domain_name.rb
lib/domain_name/etld_data.rb
lib/domain_name/punycode.rb
Parent: Object

punycode.rb - PunyCode encoder for the Domain Name library

Copyright (C) 2011 Akinori MUSHA, All rights reserved.

Ported from puny.c, a part of VeriSign XCode (encode/decode) IDN Library.

Copyright (C) 2000-2002 Verisign Inc., All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

 1) Redistributions of source code must retain the above copyright
    notice, this list of conditions and the following disclaimer.

 2) Redistributions in binary form must reproduce the above copyright
    notice, this list of conditions and the following disclaimer in
    the documentation and/or other materials provided with the
    distribution.

 3) Neither the name of the VeriSign Inc. nor the names of its
    contributors may be used to endorse or promote products derived
    from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

This software is licensed under the BSD open source license. For more information visit www.opensource.org.

Authors:

 John Colosi (VeriSign)
 Srikanth Veeramachaneni (VeriSign)
 Nagesh Chigurupati (Verisign)
 Praveen Srinivasan(Verisign)

Methods

<   <=   <=>   ==   >   >=   canonical?   canonical_tld?   cookie_domain?   etld_data   inspect   ipaddr?   new   normalize   to_s   to_str  

Classes and Modules

Module DomainName::Punycode

Constants

DOT = '.'.freeze # :nodoc:

Attributes

domain  [R]  The least "universally original" domain part of this domain name. For example, "example.co.uk" for "www.sub.example.co.uk".
hostname  [R]  The full host name normalized, ASCII-ized and downcased using the Unicode NFC rules and the Punycode algorithm. If initialized with an IP address, the string representation of the IP address suitable for opening a connection to.
ipaddr  [R]  Returns an IPAddr object if this is an IP address.
tld  [R]  The TLD part of this domain name. For example, if the hostname is "www.sub.example.co.uk", the TLD part is "uk". This property is nil only if +ipaddr?+ is true.
uri_host  [R]  Returns a host name representation suitable for use in the host name part of a URI. A host name, an IPv4 address, or a IPv6 address enclosed in square brackets.

Public Class methods

Parses hostname into a DomainName object. An IP address is also accepted. An IPv6 address may be enclosed in square brackets.

Normalizes a domain using the Punycode algorithm as necessary. The result will be a downcased, ASCII-only string.

Public Instance methods

Returns true if this domain name has a canonical registered domain.

Returns true if this domain name has a canonical TLD.

Checks if the server represented by domain is qualified to send and receive cookies for domain.

Returns true if this is an IP address, such as "192.168.0.1" and "[::1]".

to_str()

Alias for to_s

[Validate]