Method: CLIMarkdown::MDTableCleanup#to_md
- Defined in:
- lib/mdless/tables.rb
#to_md ⇒ Object
127 128 129 130 131 132 133 134 135 136 137 138 |
# File 'lib/mdless/tables.rb', line 127 def to_md output = [] t = table.clone t.each do |row| new_row = row.map.with_index { |cell, i| pad(cell, @format_row[i], column_width(i)) }.join(" | ") output.push("| #{new_row} |") end output.insert(1, header_separator_row) output.insert(0, table_border) output.push(table_border) output.join("\n") end |