Class: TTY::Table::Operation::Padding

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

Overview

A class responsible for padding field with whitespace

Used internally by Renderer

Instance Method Summary collapse

Constructor Details

#initialize(padding) ⇒ Padding

Initialize a Padding operation

Parameters:

  • padding (Strings::Padder)


17
18
19
# File 'lib/tty/table/operation/padding.rb', line 17

def initialize(padding)
  @padding = padding
end

Instance Method Details

#call(field) ⇒ TTY::Table::Field

Apply padding to a field

Parameters:

Returns:



29
30
31
# File 'lib/tty/table/operation/padding.rb', line 29

def call(field, *)
  Strings.pad(field.content, padding)
end