class AsciiParadise::AsciiTable::Row
Public Class Methods
Public Instance Methods
[](i)
click to toggle source
add_cell(i)
click to toggle source
#¶ ↑
add_cell
¶ ↑
#¶ ↑
# File lib/ascii_paradise/asciitable/row.rb, line 46 def add_cell(i) options = i.is_a?(Hash) ? i : {:value => i} cell = Cell.new(options.merge(:index => @cell_index, :table => @table)) # ======================================================================= # # The next variables are Integers. # ======================================================================= # @cell_index += cell.colspan # Count up the cell index here. @cells << cell end
Also aliased as: <<
cells?()
click to toggle source
Also aliased as: cells
height()
click to toggle source
#¶ ↑
height¶ ↑
#¶ ↑
# File lib/ascii_paradise/asciitable/row.rb, line 59 def height cells.map { |c| c.lines.count }.max end
Also aliased as: height?
render()
click to toggle source
#¶ ↑
render¶ ↑
#¶ ↑
# File lib/ascii_paradise/asciitable/row.rb, line 73 def render # ======================================================================= # # Obtain a pointer towards the horizontal character, which is usually # '-'. # ======================================================================= # horizontal_token = @table.style.border_y # ======================================================================= # # Next we check whether to colourize this. # ======================================================================= # if AsciiTable.use_colours? horizontal_token = Colours.send( AsciiParadise::AsciiTable.use_which_colours?, horizontal_token ) end array = (0...height).to_a array.map! { |line| horizontal_token + cells.map { |cell| cell.render(line) }.join(horizontal_token) + horizontal_token } result = array.join("\n") return result end
reset()
click to toggle source