class Net::DNS::RR::NS

Name Server Record (NS)

Class for DNS NS resource records.

Attributes

nsdname[R]

Gets the name server value.

Returns a String.

Public Instance Methods

value() click to toggle source

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

Returns a String.

# File lib/net/dns/rr/ns.rb, line 19
def value
  nsdname.to_s
end

Private Instance Methods

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

  name
end
get_data() click to toggle source
# File lib/net/dns/rr/ns.rb, line 64
def get_data
  @nsdname_pack
end
get_inspect() click to toggle source
# File lib/net/dns/rr/ns.rb, line 46
def get_inspect
  value
end
set_type() click to toggle source
# File lib/net/dns/rr/ns.rb, line 42
def set_type
  @type = Net::DNS::RR::Types.new("NS")
end
subclass_new_from_binary(data, offset) click to toggle source
# File lib/net/dns/rr/ns.rb, line 37
def subclass_new_from_binary(data, offset)
  @nsdname, offset = dn_expand(data, offset)
  offset
end
subclass_new_from_hash(options) click to toggle source
# File lib/net/dns/rr/ns.rb, line 25
def subclass_new_from_hash(options)
  if options.key?(:nsdname)
    @nsdname = check_name(options[:nsdname])
  else
    raise ArgumentError, ":nsdname field is mandatory"
  end
end
subclass_new_from_string(str) click to toggle source
# File lib/net/dns/rr/ns.rb, line 33
def subclass_new_from_string(str)
  @nsdname = check_name(str)
end