class Net::DNS::RR::NS

Name Server Record (NS)

Class for DNS NS resource records.

Public Instance Methods

nsdname() click to toggle source

Gets the name server value.

Returns a String.

# File lib/net/dns/rr/ns.rb, line 15
def nsdname
  @nsdname
end
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 23
def value
  nsdname.to_s
end

Private Instance Methods

build_pack() click to toggle source
# File lib/net/dns/rr/ns.rb, line 65
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 57
def check_name(input)
  name = input.to_s
  unless name =~ /(\w\.?)+\s*$/ and 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 70
def get_data
  @nsdname_pack
end
get_inspect() click to toggle source
# File lib/net/dns/rr/ns.rb, line 52
def get_inspect
  value
end
set_type() click to toggle source
# File lib/net/dns/rr/ns.rb, line 48
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 42
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 30
def subclass_new_from_hash(options)
  if options.has_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 38
def subclass_new_from_string(str)
  @nsdname = check_name(str)
end