Module: Axn::Core::AmbientContext::ClassMethods
- Defined in:
- lib/axn/core/ambient_context.rb
Instance Method Summary collapse
-
#_ambient_subfield_tree ⇒ Object
The declared ambient sub-tree, used by
_filter_to_declaredto rebuild the filtered hash along each declared path.
Instance Method Details
#_ambient_subfield_tree ⇒ Object
The declared ambient sub-tree, used by _filter_to_declared to rebuild the filtered hash
along each declared path. Ambient subfields are deliberately ABSENT from the shared
_resolved_subfields tree — ambient is excluded from the input schema, and the executor /
contradiction / facade consumers rely on that absence — so this builds a SEPARATE tree from
the SAME SubfieldTree.build machinery (no re-derivation of path/alias resolution), scoped
to a synthetic :ambient_context root plus the ambient-rooted subfield configs. Cached by
subfield_configs identity: the store is copy-on-write via += (same discipline as
_resolved_subfields), so any declaration rebuilds and an undeclaring subclass reuses the
superclass's tree.
36 37 38 39 40 41 42 43 44 45 |
# File 'lib/axn/core/ambient_context.rb', line 36 def _ambient_subfield_tree subfields = subfield_configs cached = @_axn_ambient_subfield_tree return cached.value if cached && cached.subfields.equal?(subfields) ambient = subfields.select { |c| _on_roots_at_ambient?(c.on) } value = Axn::Internal::SubfieldTree.build([_synthetic_ambient_root], ambient) @_axn_ambient_subfield_tree = AmbientSubfieldTreeCacheEntry.new(subfields:, value:) value end |