Module: ConsoleBuddy::Report
- Included in:
- IRB
- Defined in:
- lib/console_buddy/report.rb
Instance Method Summary collapse
-
#table_for(rows, headers = []) ⇒ Object
Example Usage: ConsoleBuddy::Report.table_for([[“foo”, “bar”], [“baz”, “qux”]], [“col1”, “col2”]).
-
#table_print(data, options = {}) ⇒ Object
(also: #print_data)
Example Usage: ConsoleBuddy::Report.table_print(User.all, “username”).
Instance Method Details
#table_for(rows, headers = []) ⇒ Object
Example Usage: ConsoleBuddy::Report.table_for([[“foo”, “bar”], [“baz”, “qux”]], [“col1”, “col2”])
Example 2: table_for([[“foo”, “bar”], [“baz”, “qux”]], [“col1”, “col2”])
23 24 25 26 |
# File 'lib/console_buddy/report.rb', line 23 def table_for(rows, headers = []) table = ::Terminal::Table.new(headings: headers, rows: rows) puts table end |
#table_print(data, options = {}) ⇒ Object Also known as: print_data
Example Usage: ConsoleBuddy::Report.table_print(User.all, “username”)
Example 2: table_print User.all, “username”
13 14 15 |
# File 'lib/console_buddy/report.rb', line 13 def table_print(data, = {}) puts ::TablePrint::Printer.table_print(data, ) end |