Class: TTY::Table::Operation::Wrapped Private
- Inherits:
-
Object
- Object
- TTY::Table::Operation::Wrapped
- Defined in:
- lib/tty/table/operation/wrapped.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
A class responsible for wrapping text.
Instance Attribute Summary collapse
- #widths ⇒ Object readonly private
Instance Method Summary collapse
-
#call(field, row, col) ⇒ Array[String]
Apply wrapping to a field.
-
#initialize(widths) ⇒ Wrapped
constructor
Initialize a Wrapped.
Constructor Details
#initialize(widths) ⇒ Wrapped
Initialize a Wrapped
17 18 19 |
# File 'lib/tty/table/operation/wrapped.rb', line 17 def initialize(widths) @widths = widths end |
Instance Attribute Details
#widths ⇒ Object (readonly)
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.
12 13 14 |
# File 'lib/tty/table/operation/wrapped.rb', line 12 def widths @widths end |
Instance Method Details
#call(field, row, col) ⇒ Array[String]
Apply wrapping to a field
35 36 37 38 |
# 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 |