Class Dnsruby::Name
In: lib/Dnsruby/name.rb
Parent: Object

Dnsruby::Name class

A representation of a DNS name (RFC1035, section 3.1)

methods

  • Name::create(namestring)
  • Name#absolute?
  • Name#wild?
  • Name#subdomain_of?(other)
  • Name#labels

Methods

Included Modules

Comparable

Classes and Modules

Class Dnsruby::Name::Label

Constants

MaxNameLength = 255

External Aliases

== -> eql?

Attributes

labels  [R] 

Public Class methods

Creates a new Dnsruby::Name from arg. arg can be :

  • Name:: returns arg
  • String:: returns a new Name

Public Instance methods

Returns true if this Name is absolute

Return the canonical form of this name (RFC 4034 section 6.2)

Tests subdomain-of relation : returns true if this name is a subdomain of other.

  domain = Resolv::Name.create("y.z")
  p Resolv::Name.create("w.x.y.z").subdomain_of?(domain) #=> true
  p Resolv::Name.create("x.y.z").subdomain_of?(domain) #=> true
  p Resolv::Name.create("y.z").subdomain_of?(domain) #=> false
  p Resolv::Name.create("z").subdomain_of?(domain) #=> false
  p Resolv::Name.create("x.y.z.").subdomain_of?(domain) #=> false
  p Resolv::Name.create("w.z").subdomain_of?(domain) #=> false

returns the domain name as a string.

The domain name doesn‘t have a trailing dot even if the name object is absolute.

Example :

  p Resolv::Name.create("x.y.z.").to_s #=> "x.y.z"
  p Resolv::Name.create("x.y.z").to_s #=> "x.y.z"

Is this name a wildcard?

[Validate]