Sha256: 47dcf61d5445690c3c22adc2171092c945eaad97547a5a349896a95d5df8f636
Contents?: true
Size: 903 Bytes
Versions: 3
Compression:
Stored size: 903 Bytes
Contents
# encoding: utf-8 require 'verse' module TTY class Table module Operation # A class responsible for shortening text. # # @api private class Truncation attr_reader :widths # Initialize a Truncation # # @api public def initialize(widths) @widths = widths end # Apply truncation 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 [TTY::Table::Field] # # @api public def call(field, row, col) width = widths[col] || field.width Verse.truncate(field.content, width) end end # Truncation end # Operation end # Table end # TTY
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
tty-table-0.9.0 | lib/tty/table/operation/truncation.rb |
tty-table-0.8.0 | lib/tty/table/operation/truncation.rb |
tty-table-0.7.0 | lib/tty/table/operation/truncation.rb |