Class: TTY::Table::Operation::Escape
- Inherits:
-
Object
- Object
- TTY::Table::Operation::Escape
- Defined in:
- lib/tty/table/operation/escape.rb
Overview
A class responsible for escaping special chars in a table field
Instance Method Summary collapse
-
#call(field, row, col) ⇒ Object
Escape special characters in a table field.
Instance Method Details
#call(field, row, col) ⇒ Object
Escape special characters in a table field
21 22 23 24 25 |
# File 'lib/tty/table/operation/escape.rb', line 21 def call(field, row, col) field.value = field.value.to_s.gsub(/(\t|\r|\n)/) do |val| val.dump.gsub('"', '') end end |