Method: Parse#hash_array_to_column_hash

Defined in:
lib/poisol/utils/parse.rb

#hash_array_to_column_hash(hash_array) ⇒ Object



17
18
19
20
21
22
23
24
25
# File 'lib/poisol/utils/parse.rb', line 17

def hash_array_to_column_hash hash_array
  return [] if hash_array.blank?
  column_hash = Hash.new
  hash_array[0].each_key { |key| column_hash.merge!(key=>[])}
  hash_array.each do |hash|
    column_hash.each_key {|key| column_hash[key].append hash[key]}
  end
  column_hash
end