Class: Rhales::HydrationDataAggregator

Inherits:
Object
  • Object
show all
Defined in:
lib/rhales/hydration_data_aggregator.rb

Overview

HydrationDataAggregator traverses the ViewComposition and executes all <data> sections to produce a single, merged JSON structure.

This class implements the server-side data aggregation phase of the two-pass rendering model, handling:

  • Traversal of the template dependency tree

  • Execution of <data> sections with full server context

  • Merge strategies (deep, shallow, strict)

  • Collision detection and error reporting

The aggregator replaces the HydrationRegistry by performing all data merging in a single, coordinated pass.

Defined Under Namespace

Classes: JSONSerializationError

Instance Method Summary collapse

Constructor Details

#initialize(context) ⇒ HydrationDataAggregator

Returns a new instance of HydrationDataAggregator.



23
24
25
26
27
# File 'lib/rhales/hydration_data_aggregator.rb', line 23

def initialize(context)
  @context = context
  @window_attributes = {}
  @merged_data = {}
end

Instance Method Details

#aggregate(composition) ⇒ Object

Aggregate all hydration data from the view composition



30
31
32
33
34
35
36
# File 'lib/rhales/hydration_data_aggregator.rb', line 30

def aggregate(composition)
  composition.each_document_in_render_order do |template_name, parser|
    process_template(template_name, parser)
  end

  @merged_data
end