Class: Dry::Transformer::ArrayTransformations::Combine
- Inherits:
-
Object
- Object
- Dry::Transformer::ArrayTransformations::Combine
- Defined in:
- lib/dry/transformer/array_transformations/combine.rb
Constant Summary collapse
- EMPTY_ARRAY =
[].freeze
Class Method Summary collapse
Class Method Details
.combine(array, mappings) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/dry/transformer/array_transformations/combine.rb', line 10 def combine(array, mappings) root, nodes = array return EMPTY_ARRAY if root.nil? return root if nodes.nil? groups = group_nodes(nodes, mappings) root.map do |element| element.dup.tap { |copy| add_groups_to_element(copy, groups, mappings) } end end |