Method: MakeMenu::Text::Column#add

Defined in:
lib/make_menu/text/column.rb

#add(text) ⇒ Object

Add a block of text to the column. Each row will be padded to the column width



18
19
20
21
22
23
24
25
# File 'lib/make_menu/text/column.rb', line 18

def add(text)
  self.rows += text.split("\n").map do |row|
    self.width = row.decolor.size + SPACING unless width
    self.width = [width, row.decolor.size + SPACING].max
    row.gsub("\r", '')
  end
  self.row_index += text.lines.size
end