Class: Glancer::Utils::ResultFormatter
- Inherits:
-
Object
- Object
- Glancer::Utils::ResultFormatter
- Defined in:
- lib/glancer/utils/result_formatter.rb
Class Method Summary collapse
Class Method Details
.normalize(rows) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/glancer/utils/result_formatter.rb', line 6 def self.normalize(rows) return rows if rows.empty? keys = rows.first.keys if rows.all? { |r| r.keys.sort == keys.sort } normalized = {} keys.each do |key| normalized[key] = rows.map { |row| row[key] } end normalized else rows end end |