lib/packetgen/header/dns/rrsection.rb in packetgen-3.3.3 vs lib/packetgen/header/dns/rrsection.rb in packetgen-4.0.0
- old
+ new
@@ -9,14 +9,14 @@
module PacketGen
module Header
class DNS
# Define a DNS Ressource Record Section
# @author Sylvain Daubert
- class RRSection < Types::Array
+ class RRSection < BinStruct::Array
# @api private
# @param [DNS] dns
- # @param [Types::Int] counter
+ # @param [BinStruct::Int] counter
def initialize(dns, counter)
super(counter: counter)
@dns = dns
end
@@ -30,18 +30,18 @@
PacketGen.force_binary str
while !str.empty? && (self.size < @counter.to_i)
rr = RR.new(@dns).read(str)
rr = OPT.new(@dns).read(str) if rr.type?('OPT')
str.slice!(0, rr.sz)
- push rr
+ push(rr)
end
self
end
private
def record_from_hash(hsh)
- if hsh.key? :rtype
+ if hsh.key?(:rtype)
case hsh.delete(:rtype)
when 'Question'
Question.new(@dns, hsh)
when 'OPT'
OPT.new(@dns, hsh)