Method: TTY::Table::Renderer::Basic#initialize
- Defined in:
- lib/tty/table/renderer/basic.rb
permalink #initialize(table, options = {}) ⇒ TTY::Table::Renderer::Basic
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Initialize a Renderer
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 |
# File 'lib/tty/table/renderer/basic.rb', line 112 def initialize(table, = {}) @table = assert_table_type(table) @multiline = .fetch(:multiline) { false } @border = BorderDSL.new(.delete(:border)). unless @table.separators.empty? @border.separator ||= @table.separators end @column_widths = .fetch(:column_widths, nil) alignment = Array([:alignment]) * table.columns_size @alignments = AlignmentSet.new([:alignments] || alignment) @filter = .fetch(:filter) { proc { |val, _| val } } @width = .fetch(:width) { TTY::Screen.width } @border_class = .fetch(:border_class) { Border::Null } @indent = .fetch(:indent) { 0 } @resize = .fetch(:resize) { false } @padding = Strings::Padder.parse([:padding]) end |