Method: TTY::Table::Validatable#assert_row_sizes

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

#assert_row_sizes(rows) ⇒ nil

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.

Check if table rows are the equal size

Returns:

  • (nil)

Raises:



19
20
21
22
23
24
25
26
# File 'lib/tty/table/validatable.rb', line 19

def assert_row_sizes(rows)
  size = (rows[0] || []).size
  rows.each do |row|
    next if row.size == size
    fail TTY::Table::DimensionMismatchError,
         "row size differs (#{row.size} should be #{size})"
  end
end