class Net::DNS::RR::CNAME

Canonical Name Record (CNAME)

Class for DNS CNAME resource records.

A CNAME record maps an alias or nickname to the real or Canonical name which may lie outside the current zone. Canonical means expected or real name.

Attributes

cname[R]

Gets the canonical name value.

Returns a String.

Public Instance Methods

value() click to toggle source

Gets the standardized value for this record, represented by the value of cname.

Returns a String.

# File lib/net/dns/rr/cname.rb, line 23
def value
  cname.to_s
end

Private Instance Methods

build_pack() click to toggle source
# File lib/net/dns/rr/cname.rb, line 63
def build_pack
  @cname_pack = pack_name(@cname)
  @rdlength = @cname_pack.size
end
check_name(input) click to toggle source
# File lib/net/dns/rr/cname.rb, line 54
def check_name(input)
  name = input.to_s
  unless name =~ /(\w\.?)+\s*$/ && name =~ /[a-zA-Z]/
    raise ArgumentError, "Invalid Canonical Name `#{name}'"
  end

  name
end
get_data() click to toggle source
# File lib/net/dns/rr/cname.rb, line 68
def get_data
  @cname_pack
end
get_inspect() click to toggle source
# File lib/net/dns/rr/cname.rb, line 50
def get_inspect
  value
end
set_type() click to toggle source
# File lib/net/dns/rr/cname.rb, line 46
def set_type
  @type = Net::DNS::RR::Types.new("CNAME")
end
subclass_new_from_binary(data, offset) click to toggle source
# File lib/net/dns/rr/cname.rb, line 41
def subclass_new_from_binary(data, offset)
  @cname, offset = dn_expand(data, offset)
  offset
end
subclass_new_from_hash(options) click to toggle source
# File lib/net/dns/rr/cname.rb, line 29
def subclass_new_from_hash(options)
  if options.key?(:cname)
    @cname = check_name(options[:cname])
  else
    raise ArgumentError, ":cname field is mandatory"
  end
end
subclass_new_from_string(str) click to toggle source
# File lib/net/dns/rr/cname.rb, line 37
def subclass_new_from_string(str)
  @cname = check_name(str)
end