Class: TTY::Table::Operation::Alignment

Inherits:
Object
  • Object
show all
Defined in:
lib/tty/table/operation/alignment.rb

Overview

A class which responsiblity is to align table rows and header.

Constant Summary collapse

DEFAULT =
:left

Instance Method Summary collapse

Constructor Details

#initialize(alignments, widths = nil) ⇒ Alignment

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.

Initialize an Alignment operation



15
16
17
18
# File 'lib/tty/table/operation/alignment.rb', line 15

def initialize(alignments, widths = nil)
  @alignments = alignments
  @widths     = widths
end

Instance Method Details

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

Evaluate alignment of the provided row

Parameters:

  • field (TTY::Table::Field)

    the table field

  • row (Array)

    the table row

  • col (Integer)

    the table column index

Returns:



34
35
36
# File 'lib/tty/table/operation/alignment.rb', line 34

def call(field, row, col)
  align_field(field, col)
end