class TTY::Table::Operation::Escape

A class responsible for escaping special chars in a table field

@api private

Public Instance Methods

call(field, row, col) click to toggle source

Escape special characters in a table field

@param [TTY::Table::Field] field

@param [Integer] row

the field row index

@param [Integer] col

the field column index

@api public

# 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