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/ptr.rb
Views: 11784
# -*- coding: binary -*-1##2#3# Net::DNS::RR::PTR4#5# $Id: PTR.rb,v 1.5 2006/07/28 07:33:36 bluemonk Exp $6#7##89module Net10module DNS11class RR1213#------------------------------------------------------------14# RR type PTR15#------------------------------------------------------------16class PTR < RR1718# Getter for PTR resource19def ptr20@ptrdname.to_s21end22alias_method :ptrdname, :ptr2324private2526def check_ptr(str)27IPAddr.new str28rescue29raise RRArgumentError, "PTR section not valid"30end3132def build_pack33@ptrdname_pack = pack_name(@ptrdname)34@rdlength = @ptrdname_pack.size35end3637def set_type38@type = Net::DNS::RR::Types.new("PTR")39end4041def get_data42@ptrdname_pack43end4445def get_inspect46"#@ptrdname"47end4849def subclass_new_from_hash(args)50if args.has_key? :ptrdname or args.has_key? :ptr51@ptrdname = args[0][:ptrdname]52else53raise RRArgumentError, ":ptrdname or :ptr field is mandatory but missing"54end55end5657def subclass_new_from_string(str)58@ptrdname = check_ptr(str)59end6061def subclass_new_from_binary(data,offset)62@ptrdname,offset = dn_expand(data,offset)63return offset64end6566end # class PTR6768end # class RR69end # module DNS70end # module Net717273