Method: TTY::Table::Field#lines

Defined in:
lib/tty/table/field.rb

#linesArray[String]

Return number of lines this value spans.

A distinction is being made between escaped and non-escaped strings.

Returns:

  • (Array[String])
[View source]

98
99
100
101
# File 'lib/tty/table/field.rb', line 98

def lines
  escaped = content.scan(/(\\n|\\t|\\r)/)
  escaped.empty? ? content.split(/\n/, -1) : [content]
end