Class List Method List File List

# Class: Terminal::Table

Inherits:
  Object
  - Object
  - Terminal::Table
  show all
Defined in:
  lib/common/hacks.rb

## Defined Under Namespace

Classes: Style

## Instance Method Summary (collapse)

- - (Object) render (also: #to_s)

## Instance Method Details

### - (`Object`) render Also known as: to_s

    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    # File 'lib/common/hacks.rb', line 85

    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