Class: Packetman::Table
Instance Method Summary
collapse
#config, included, #protocols
Constructor Details
#initialize ⇒ Table
Returns a new instance of Table.
7
8
9
10
|
# File 'lib/packetman/table.rb', line 7
def initialize
@term_table = Terminal::Table.new(headings: headings, rows: rows, style: style)
end
|
Instance Method Details
#headings ⇒ Object
12
13
14
|
# File 'lib/packetman/table.rb', line 12
def headings
[*0..31].map{ |c| "%02d" % c }
end
|
#rows ⇒ Object
16
17
18
|
# File 'lib/packetman/table.rb', line 16
def rows
protocols[config.transport]['table']
end
|
#style ⇒ Object
20
21
22
|
# File 'lib/packetman/table.rb', line 20
def style
{ alignment: :center, padding_left: 0, padding_right: 0}
end
|
#to_s ⇒ Object
24
25
26
|
# File 'lib/packetman/table.rb', line 24
def to_s
@term_table.to_s
end
|