lib/packetgen/header/ip/options.rb in packetgen-3.1.3 vs lib/packetgen/header/ip/options.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
class IP
# Class to handle IP options
# @author Sylvain Daubert
@@ -17,12 +17,10 @@
# Get binary string
# @return [String]
def to_s
str = super
- if str.length % 4 != 0
- str += ([0] * (4 - (str.length % 4))).pack('C*')
- end
+ str += ([0] * (4 - (str.length % 4))).pack('C*') if str.length % 4 != 0
str
end
private