Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/lib/net/dns/rr/ns.rb
Views: 11784
# -*- coding: binary -*-1##2#3# Net::DNS::RR::NS4#5# $Id: NS.rb,v 1.8 2006/07/28 07:33:36 bluemonk Exp $6#7##89module Net10module DNS1112class RR1314#------------------------------------------------------------15# RR type NS16#------------------------------------------------------------17class NS < RR18attr_reader :nsdname1920private2122def check_name(name)23unless name =~ /(\w\.?)+\s*$/ and name =~ /[a-zA-Z]/24raise RRArgumentError, "NS Domain Name not valid: #{name}"25end26name27end2829def build_pack30@nsdname_pack = pack_name(@nsdname)31@rdlength = @nsdname_pack.size32end3334def set_type35@type = Net::DNS::RR::Types.new("NS")36end3738def get_data39@nsdname_pack40end4142def get_inspect43"#@nsdname"44end4546def subclass_new_from_hash(args)47if args.has_key? :nsdname48@nsdname = check_name args[:nsdname]49else50raise RRArgumentError, ":nsdname field is mandatory but missing"51end52end5354def subclass_new_from_string(str)55@nsdname = check_name(str)56end5758def subclass_new_from_binary(data,offset)59@nsdname,offset = dn_expand(data,offset)60return offset61end6263end # class NS6465end # class RR66end # module DNS67end # module Net686970