Class: Array

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

Instance Method Summary collapse

Instance Method Details

#qa_columnizedObject



13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/query_analyzer.rb', line 13

def qa_columnized
  sized = {}
  self.each do |row|
    row.values.each_with_index do |value, i|
      sized[i] = [sized[i].to_i, row.keys[i].length, value.to_s.length].max
    end
  end

  table = []
  table << qa_columnized_row(self.first.keys, sized)
  table << '-' * table.first.length
  self.each { |row| table << qa_columnized_row(row.values, sized) }
  table.join("\n   ") # Spaces added to work with format_log_entry
end