eizengan/reforge

View on GitHub
lib/reforge/transformation/tree/aggregate_node/hash_node.rb

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
# frozen_string_literal: true

module Reforge
  class Transformation
    class Tree
      class AggregateNode
        class HashNode
          attr_reader :children

          def initialize
            @children = {}
          end

          def call(source)
            children.transform_values { |child| child.call(source) }
          end

          def update_path(path)
            children.each { |key, child| child.update_path(path + [key]) }
          end
        end
      end
    end
  end
end