Files
metasploit-gs/lib/msf/ui/console/table.rb
T

60 lines
858 B
Ruby
Raw Normal View History

# -*- coding: binary -*-
2005-07-07 14:22:47 +00:00
module Msf
module Ui
module Console
###
#
# Console table display wrapper that allows for stylized tables
#
###
2016-08-10 13:30:09 -05:00
class Table < Rex::Text::Table
2005-07-07 14:22:47 +00:00
2013-08-30 16:28:33 -05:00
#
# Default table styles.
#
module Style
Default = 0
end
#
# Initializes a wrappered table with the supplied style and options.
#
def initialize(style, opts = {})
self.style = style
if (self.style == Style::Default)
opts['Indent'] = 3
if (!opts['Prefix'])
opts['Prefix'] = "\n"
end
if (!opts['Postfix'])
opts['Postfix'] = "\n"
end
super(opts)
end
end
#
# Print nothing if there are no rows if the style is default.
#
def to_s
if (style == Style::Default)
return '' if (rows.length == 0)
end
super
end
2005-07-07 23:11:03 +00:00
protected
2013-08-30 16:28:33 -05:00
attr_accessor :style # :nodoc:
2005-07-07 23:11:03 +00:00
2005-07-07 14:22:47 +00:00
end
end
end
2012-04-15 23:35:38 -05:00
end