Class: TableInspector::TerminalTable

Inherits:
Object
  • Object
show all
Defined in:
lib/table_inspector/terminal_table.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**options) {|_self| ... } ⇒ TerminalTable

Returns a new instance of TerminalTable.

Yields:

  • (_self)

Yield Parameters:



10
11
12
13
14
15
# File 'lib/table_inspector/terminal_table.rb', line 10

def initialize(**options, &block)
  @terminal_table = ::Terminal::Table.new(**options)
  style = TableInspector.style || { border: :ascii }
  @terminal_table.style = style
  yield self if block_given?
end

Instance Attribute Details

#terminal_tableObject (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

#renderObject



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