Method: Marktable::Row.parse

Defined in:
lib/marktable/row.rb

.parse(row_string) ⇒ Object

Parse a markdown row string into an array of values



71
72
73
74
75
76
77
78
79
80
# File 'lib/marktable/row.rb', line 71

def self.parse(row_string)
  # Skip if nil or empty
  return [] if row_string.nil? || row_string.strip.empty?

  # Remove leading/trailing pipes and split by pipe
  cells = row_string.strip.sub(/^\|/, '').sub(/\|$/, '').split('|')

  # Trim whitespace from each cell
  cells.map(&:strip)
end