Class: Terminal::Table

Inherits:
Object
  • Object
show all
Defined in:
lib/common/hacks.rb

Defined Under Namespace

Classes: Style

Instance Method Summary collapse

Instance Method Details

#renderObject Also known as: to_s


62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/common/hacks.rb', line 62

def render
  separator = Separator.new(self)
  buffer = [separator]
  unless @title.nil?
    buffer << Row.new(self, [title_cell_options])
    buffer << separator
  end
  unless @headings.cells.empty?
    buffer << @headings
    buffer << separator
  end
  buffer += @rows
  buffer << separator
  buffer.map { |r| style.margin_left + r.render }.join("\n")
end