Class: Gloo::App::Table
- Inherits:
-
Object
- Object
- Gloo::App::Table
- Defined in:
- lib/gloo/app/table.rb
Instance Method Summary collapse
-
#box(str_value) ⇒ Object
Put a box around the given string.
-
#initialize(platform) ⇒ Table
constructor
Set up Table Helper.
-
#show(headers, data, title = nil) ⇒ Object
Show the given table data.
Constructor Details
#initialize(platform) ⇒ Table
Set up Table Helper.
16 17 18 |
# File 'lib/gloo/app/table.rb', line 16 def initialize platform @platform = platform end |
Instance Method Details
#box(str_value) ⇒ Object
Put a box around the given string.
22 23 24 25 26 |
# File 'lib/gloo/app/table.rb', line 22 def box( str_value ) puts str_value box = Terminal::Table.new( :headings => [], :rows => [ [ str_value ] ] ) return box.to_s end |
#show(headers, data, title = nil) ⇒ Object
Show the given table data.
31 32 33 34 35 36 37 38 39 |
# File 'lib/gloo/app/table.rb', line 31 def show( headers, data, title = nil ) unless title.blank? table = Terminal::Table.new( :title => title, :headings => headers, :rows => data ) else table = Terminal::Table.new( :headings => headers, :rows => data ) end puts table.to_s.colorize( color: :white, background: :black ) end |