Module: Lutaml::Xml::PlanHydrator

Defined in:
lib/lutaml/xml/plan_hydrator.rb

Overview

Hydrates model instances from a Descriptor#walk PlanValue tree, keyed by each value's producing row name (never position — rows for missing elements are simply absent). Builds constructor kwargs recursively and instantiates through .new, so typing, defaults, and collection semantics all ride the constructor.

Class Method Summary collapse

Class Method Details

.call(model_class, plan, value) ⇒ Object

plan: the compiler's entry for model_class value: the walk root PlanValue (element)



14
15
16
17
18
# File 'lib/lutaml/xml/plan_hydrator.rb', line 14

def call(model_class, plan, value)
  kwargs = attributes_kwargs(plan, value)
  kwargs.merge!(children_kwargs(model_class, plan, value))
  model_class.new(**kwargs)
end