Method: TTY::Table::Renderer.render

Defined in:
lib/tty/table/renderer.rb

.render(table, options = {}) {|renderer| ... } ⇒ String

Render a given table and return the string representation.

Parameters:

  • table (TTY::Table)

    the table to be rendered

  • options (Hash) (defaults to: {})

    the options to render the table with

Options Hash (options):

  • :renderer (String)

    used to format table output

Yields:

Returns:

  • (String)


74
75
76
77
78
# File 'lib/tty/table/renderer.rb', line 74

def render(table, options = {}, &block)
  renderer = select(options[:renderer]).new(table, options)
  yield renderer if block_given?
  renderer.render
end