Module: TTY::Table::Validatable
- Included in:
- TTY::Table
- Defined in:
- lib/tty/table/validatable.rb
Constant Summary collapse
- MIN_CELL_WIDTH =
3.freeze
Instance Method Summary collapse
- #assert_matching_widths(rows) ⇒ Object
-
#assert_row_sizes(rows) ⇒ nil
private
Check if table rows are the equal size.
- #assert_string_values(rows) ⇒ Object
Instance Method Details
#assert_matching_widths(rows) ⇒ Object
26 27 |
# File 'lib/tty/table/validatable.rb', line 26 def assert_matching_widths(rows) end |
#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
17 18 19 20 21 22 23 24 |
# File 'lib/tty/table/validatable.rb', line 17 def assert_row_sizes(rows) size = (rows[0] || []).size rows.each do |row| if not row.size == size raise TTY::Table::DimensionMismatchError, "row size differs (#{row.size} should be #{size})" end end end |
#assert_string_values(rows) ⇒ Object
29 30 |
# File 'lib/tty/table/validatable.rb', line 29 def assert_string_values(rows) end |