Class: TTY::Table::Operation::Escape Private

Inherits:
Object
  • Object
show all
Defined in:
lib/tty/table/operation/escape.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 escaping special chars in a table field

Instance Method Summary collapse

Instance Method Details

#call(field, row, col) ⇒ Object

Escape special characters in a table field

Parameters:

  • field (TTY::Table::Field)
  • row (Integer)

    the field row index

  • col (Integer)

    the field column index



21
22
23
24
25
# File 'lib/tty/table/operation/escape.rb', line 21

def call(field, row, col)
  field.content.gsub(/(\t|\r|\n)/) do |val|
    val.dump.gsub('"', "")
  end
end