Class: Gemat::OrgFormatter

Inherits:
Formatter show all
Defined in:
lib/org_formatter.rb

Instance Method Summary collapse

Methods inherited from Formatter

#initialize, #run

Constructor Details

This class inherits a constructor from Gemat::Formatter

Instance Method Details

#gen_rowsObject

rubocop:disable Metrics/AbcSize



8
9
10
11
12
13
14
# File 'lib/org_formatter.rb', line 8

def gen_rows
  @rows << "| #{@columns.map { |column| column.column_name.ljust(column.max_length) }.join(' | ')} |"
  @rows << "|#{@columns.map { |column| '-' * (column.max_length + 2) }.join('+')}|"
  @gems.each do |gem|
    @rows << "| #{@columns.map { |column| column.call(gem).to_s.ljust(column.max_length) }.join(' | ')} |"
  end
end