lib/packetgen/header/tcp.rb in packetgen-3.1.3 vs lib/packetgen/header/tcp.rb in packetgen-3.1.4
- old
+ new
@@ -1,12 +1,12 @@
+# frozen_string_literal: true
+
# This file is part of PacketGen
# See https://github.com/sdaubert/packetgen for more informations
# Copyright (C) 2016 Sylvain Daubert <sylvain.daubert@laposte.net>
# This program is published under MIT license.
-# frozen_string_literal: true
-
module PacketGen
module Header
# TCP header ({https://tools.ietf.org/html/rfc793 RFC 793})
# 0 1 2 3
# 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
@@ -233,10 +233,10 @@
shift = Inspect.shift_level
str = Inspect.inspect_attribute(attr, self[attr])
doff = Inspect.int_dec_hex(data_offset, 1)
str << shift << Inspect::FMT_ATTR % ['', 'data_offset', doff]
str << shift << Inspect::FMT_ATTR % ['', 'reserved', reserved]
- flags = ''.dup
+ flags = +''
%w[ns cwr ece urg ack psh rst syn fin].each do |fl|
flags << (send("flag_#{fl}?") ? fl[0].upcase : '.')
end
str << shift << Inspect::FMT_ATTR % ['', 'flags', flags]
end