Class: TableInspector::TerminalTable
- Inherits:
-
Object
- Object
- TableInspector::TerminalTable
- Defined in:
- lib/table_inspector/terminal_table.rb
Instance Attribute Summary collapse
-
#terminal_table ⇒ Object
readonly
Returns the value of attribute terminal_table.
Instance Method Summary collapse
-
#initialize(**options) {|_self| ... } ⇒ TerminalTable
constructor
A new instance of TerminalTable.
- #render ⇒ Object
Constructor Details
#initialize(**options) {|_self| ... } ⇒ TerminalTable
Returns a new instance of TerminalTable.
10 11 12 13 14 15 |
# File 'lib/table_inspector/terminal_table.rb', line 10 def initialize(**, &block) @terminal_table = ::Terminal::Table.new(**) style = TableInspector.style || { border: :ascii } @terminal_table.style = style yield self if block_given? end |
Instance Attribute Details
#terminal_table ⇒ Object (readonly)
Returns the value of attribute terminal_table.
4 5 6 |
# File 'lib/table_inspector/terminal_table.rb', line 4 def terminal_table @terminal_table end |
Instance Method Details
#render ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/table_inspector/terminal_table.rb', line 17 def render if rows.empty? Text.break_line puts " Empty." else puts self end end |