Class: Axn::Internal::ResolvedSubfields
- Inherits:
-
Data
- Object
- Data
- Axn::Internal::ResolvedSubfields
- Defined in:
- lib/axn/internal/resolved_subfields.rb
Overview
The canonical resolved-subfield artifact (PRO-2883): the SubfieldTree plus its derived
{required, nullable} annotations and its dropped-deep-config verdict, built once from a class's
declared configs and cached per class (see ContractForSubfields::ClassMethods#_resolved_subfields).
Both annotations and dropped are Reflection::Schema's judgment over the tree, composed in here so
Core:: reads either as a cheap reader on the runtime path rather than recomputing it. Deep-frozen
before it is published, so the runtime hot path can never mutate it — and a benign first-call build
race between threads just produces two identical values.
Instance Attribute Summary collapse
-
#annotations ⇒ Object
readonly
Returns the value of attribute annotations.
-
#dropped ⇒ Object
readonly
Returns the value of attribute dropped.
-
#tree ⇒ Object
readonly
Returns the value of attribute tree.
Class Method Summary collapse
Instance Method Summary collapse
- #index ⇒ Object
-
#roots ⇒ Object
Convenience delegators for the tree's members.
Instance Attribute Details
#annotations ⇒ Object (readonly)
Returns the value of attribute annotations
15 16 17 |
# File 'lib/axn/internal/resolved_subfields.rb', line 15 def annotations @annotations end |
#dropped ⇒ Object (readonly)
Returns the value of attribute dropped
15 16 17 |
# File 'lib/axn/internal/resolved_subfields.rb', line 15 def dropped @dropped end |
#tree ⇒ Object (readonly)
Returns the value of attribute tree
15 16 17 |
# File 'lib/axn/internal/resolved_subfields.rb', line 15 def tree @tree end |
Class Method Details
.build(field_configs, subfield_configs) ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/axn/internal/resolved_subfields.rb', line 16 def self.build(field_configs, subfield_configs) tree = SubfieldTree.build(field_configs, Array(subfield_configs)) annotations = Reflection::Schema.derive_annotations(tree.roots) dropped = Reflection::Schema.dropped_from_deep_paths(tree.deep_paths) _deep_freeze!(tree) new(tree:, annotations: annotations.freeze, dropped: dropped.freeze) end |
Instance Method Details
#index ⇒ Object
50 |
# File 'lib/axn/internal/resolved_subfields.rb', line 50 def index = tree.index |
#roots ⇒ Object
Convenience delegators for the tree's members. dropped is its own Data member (above), not a
delegator: the tree only collects the deep candidate pairs (deep_paths), and the drop verdict
is what this artifact composes in on top, once, at build time.
49 |
# File 'lib/axn/internal/resolved_subfields.rb', line 49 def roots = tree.roots |