rubocop -A lib/packet.rb

This commit is contained in:
ChillerDragon 2022-11-05 17:27:13 +01:00
parent e7f1d82e2d
commit 70a03dc88f

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'huffman_tw'
class PacketFlags
@ -70,14 +72,14 @@ class Packet
token = bytes[3..6].join(' ').green
payload = bytes[7..].join(' ')
puts @prefix + " data: #{[header, token, payload].join(' ')}"
print @prefix + ' '
print "#{@prefix} "
print 'header'.ljust(3 * 3, ' ').yellow
print 'token'.ljust(4 * 3, ' ').green
puts 'data'
end
def to_s
puts @prefix + 'Packet'
puts "#{@prefix}Packet"
puts @prefix + " flags: #{@flags}"
bytes = str_hex(@data).split(' ')
# TODO: check terminal size?
@ -85,7 +87,7 @@ class Packet
rows = bytes.groups_of(max_width)
annotate_first_row(rows.first)
rows[1..].each do |row|
print @prefix + ' '
print "#{@prefix} "
puts row.join(' ')
end
puts ''