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.
15 16 17 |
# File 'lib/gloo/app/table.rb', line 15 def initialize platform @platform = platform end |
Instance Method Details
#box(str_value) ⇒ Object
Put a box around the given string.
21 22 23 24 25 |
# File 'lib/gloo/app/table.rb', line 21 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.
Deliberately left uncolored: box-drawing borders and text read fine against the terminal's own default colors, and forcing a fixed foreground/background (as this used to do) fought whatever theme the terminal was actually running.
35 36 37 38 39 40 41 42 43 |
# File 'lib/gloo/app/table.rb', line 35 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 end |