Method: TTY::Table::Operation::Truncation#call

Defined in:
lib/tty/table/operation/truncation.rb

#call(field, row, col) ⇒ TTY::Table::Field

Apply truncation to a field

Parameters:

  • field (TTY::Table::Field)

    the table field

  • row (Integer)

    the field row index

  • col (Integer)

    the field column index

Returns:



36
37
38
39
# File 'lib/tty/table/operation/truncation.rb', line 36

def call(field, row, col)
  column_width = widths[col] || field.width
  Strings.truncate(field.content, column_width)
end