Module | Sequel::PrettyTable
In: | lib/sequel/extensions/_pretty_table.rb

### Methods

print string

### Public Class methods

print(records, columns=nil)

Prints nice-looking plain-text tables via puts

      +--+-------+
      |id|name   |
      |--+-------|
      |1 |fasdfas|
      |2 |test   |
      +--+-------+

[Source]

        # File lib/sequel/extensions/_pretty_table.rb, line 19
    19:     def self.print(records, columns=nil)
    20:       puts string(records, columns)
    21:     end

string(records, columns = nil)

Return the string that print will print via puts.

[Source]

        # File lib/sequel/extensions/_pretty_table.rb, line 24
    24:     def self.string(records, columns = nil) # records is an array of hashes
    25:       columns ||= records.first.keys.sort_by{|x|x.to_s}
    26:       sizes = column_sizes(records, columns)
    27:       sep_line = separator_line(columns, sizes)
    28:
    29:       array = [sep_line, header_line(columns, sizes), sep_line]
    30:       records.each {|r| array << data_line(columns, sizes, r)}
    31:       array << sep_line
    32:       array.join("\n")
    33:     end

[Validate]