diff --git a/lib/zip/extra_field/universal_time.rb b/lib/zip/extra_field/universal_time.rb index a1bfaab5..99838812 100644 --- a/lib/zip/extra_field/universal_time.rb +++ b/lib/zip/extra_field/universal_time.rb @@ -9,7 +9,8 @@ def initialize(binstr = nil) @mtime = nil @atime = nil @flag = 0 - binstr && merge(binstr) + + merge(binstr) unless binstr.nil? end attr_reader :atime, :ctime, :mtime, :flag @@ -63,15 +64,15 @@ def ==(other) def pack_for_local s = [@flag].pack('C') - @flag & 1 != 0 && s << [@mtime.to_i].pack('l<') - @flag & 2 != 0 && s << [@atime.to_i].pack('l<') - @flag & 4 != 0 && s << [@ctime.to_i].pack('l<') + s << [@mtime.to_i].pack('l<') unless @flag & 1 == 0 + s << [@atime.to_i].pack('l<') unless @flag & 2 == 0 + s << [@ctime.to_i].pack('l<') unless @flag & 4 == 0 s end def pack_for_c_dir s = [@flag].pack('C') - @flag & 1 == 1 && s << [@mtime.to_i].pack('l<') + s << [@mtime.to_i].pack('l<') unless @flag & 1 == 0 s end end