Module: HashPivot

Defined in:
lib/hash_pivot.rb,
lib/hash_pivot/table.rb,
lib/hash_pivot/version.rb,
lib/hash_pivot/repository/base.rb,
lib/hash_pivot/repository/hash_repository.rb,
lib/hash_pivot/error/not_implemented_error.rb,
lib/hash_pivot/repository/struct_repository.rb,
lib/hash_pivot/repository/active_record_repository.rb

Defined Under Namespace

Modules: Error, Repository Classes: Table

Constant Summary collapse

VERSION =
'0.3.1'

Class Method Summary collapse

Class Method Details

.pivot(data, group, pivot_in, pivot_header, repository: HashPivot::Repository::HashRepository, &block) ⇒ Hash

Parameters:

Returns:

  • (Hash)


16
17
18
19
20
21
22
23
# File 'lib/hash_pivot.rb', line 16

def self.pivot(data, group, pivot_in, pivot_header, repository: HashPivot::Repository::HashRepository, &block)
  pivot_kinds = if pivot_header.is_a?(Array)
                  transform_to_hash(pivot_header)
                else
                  pivot_header
                end
  Table.new(data, repository: repository).pivot(group, pivot_in, pivot_kinds, &block)
end