Class: HashPivot::Repository::StructRepository

Inherits:
Object
  • Object
show all
Includes:
Base
Defined in:
lib/hash_pivot/repository/struct_repository.rb

Instance Method Summary collapse

Methods included from Base

#hash_by_group, included, #initialize

Instance Method Details

#translate_data(data) ⇒ Object



10
11
12
13
14
15
16
17
# File 'lib/hash_pivot/repository/struct_repository.rb', line 10

def translate_data(data)
  data.map do |r|
    attribute_names = r.members
    attribute_names.each_with_object({}).with_index do |(attribute_name, memo), index|
      memo[attribute_name] = r[index]
    end
  end
end