Method: Ruport::Formatter::Text#build_table_header
- Defined in:
- lib/ruport/formatter/text.rb
#build_table_header ⇒ Object
Uses the column names from the given Data::Table to generate a table header.
Calls fit_to_width to truncate the table heading if necessary.
73 74 75 76 77 78 79 80 81 |
# File 'lib/ruport/formatter/text.rb', line 73 def build_table_header return unless should_render_column_names? c = data.column_names.enum_for(:each_with_index).map { |f,i| f.to_s.center(.max_col_width[i]) } output << fit_to_width("#{hr}| #{c.join(' | ')} |\n") end |