lib/packetgen/packet.rb in packetgen-2.1.1 vs lib/packetgen/packet.rb in packetgen-2.1.2

- old
+ new

@@ -43,11 +43,11 @@ # # == Save packets to a file # Packet.write 'file.pcapng', packets # # @since 2.0.0 - # + # # Packet accessor has changed. When header class is in a namespace # (for example Dot11::* header classes), to avoid clashes in names, such # accessors are named +namespace_class+. For example {Header::Dot11::Data} # header is now accessed through +Packet#dot11_data+ and nor more +Packet#data+). # @author Sylvain Daubert @@ -95,11 +95,11 @@ capture.start end capture.packets end - # Read packets from +filename+. + # Read packets from +filename+. Mays read Pcap and Pcap-NG formats. # # For more control, see {PcapNG::File} or {PCAPRUB::Pcap}. # @param [String] filename PcapNG or Pcap file. # @return [Array<Packet>] # @author Sylvain Daubert @@ -109,10 +109,10 @@ PcapNG::File.new.read_packets filename rescue => e raise ArgumentError, e unless File.extname(filename.downcase) == '.pcap' packets = [] PCAPRUB::Pcap.open_offline(filename).each_packet do |packet| - next unless packet = PacketGen.parse(packet.to_s) + next unless packet = PacketGen.parse(packet.to_s) packets << packet end packets end end