Sha256: 732aff6490adbedd82c01f32efda06797181e9be3290f14354efde58e720402c

Contents?: true

Size: 449 Bytes

Versions: 4

Compression:

Stored size: 449 Bytes

Contents

# frozen_string_literal: true

require_relative './base'

module HashPivot
  module Repository
    class StructRepository
      include HashPivot::Repository::Base

      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
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
hash_pivot-0.3.1 lib/hash_pivot/repository/struct_repository.rb
hash_pivot-0.3.0 lib/hash_pivot/repository/struct_repository.rb
hash_pivot-0.2.0 lib/hash_pivot/repository/struct_repository.rb
hash_pivot-0.1.0 lib/hash_pivot/repository/struct_repository.rb