class TTY::Table::Operation::Wrapped
A class responsible for wrapping text.
@api private
Attributes
widths[R]
Public Class Methods
new(widths)
click to toggle source
Initialize a Wrapped
@api public
# File lib/tty/table/operation/wrapped.rb, line 17 def initialize(widths) @widths = widths end
Public Instance Methods
call(field, row, col)
click to toggle source
Apply wrapping to a field
@param [TTY::Table::Field] field
the table field
@param [Integer] row
the field row index
@param [Integer] col
the field column index
@return [Array]
@api public
# File lib/tty/table/operation/wrapped.rb, line 35 def call(field, row, col) column_width = widths[col] || field.width Strings.wrap(field.content, column_width) end