Class: Axn::Internal::SubfieldTree::ResolvedPath

Inherits:
Data
  • Object
show all
Defined in:
lib/axn/internal/subfield_tree.rb

Overview

A config's resolved position in the tree, recorded once at build so runtime consumers never re-split on: strings or re-resolve reader aliases. node is the config's leaf Node; wire_path is the full provided_data lookup path ([top-level wire key, *wire segments]); ancestors is the hop chain ([Node, wire segment] pairs, outermost first — each hop's node is the parent the segment is read from), so canonical parent resolution (resolve_parent) can walk each hop through its own reader and reflection can reason about each intermediate node's declared type. parent_index is the chain index of the on: TARGET node (the value the config's own field is extracted from), which canonical parent resolution resolves through the deepest reader-bearing ancestor. A top-level config is the depth-0 case: wire_path is just [field], ancestors are empty, parent_index 0.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#ancestorsObject (readonly)

Returns the value of attribute ancestors

Returns:

  • (Object)

    the current value of ancestors



36
37
38
# File 'lib/axn/internal/subfield_tree.rb', line 36

def ancestors
  @ancestors
end

#nodeObject (readonly)

Returns the value of attribute node

Returns:

  • (Object)

    the current value of node



36
37
38
# File 'lib/axn/internal/subfield_tree.rb', line 36

def node
  @node
end

#parent_indexObject (readonly)

Returns the value of attribute parent_index

Returns:

  • (Object)

    the current value of parent_index



36
37
38
# File 'lib/axn/internal/subfield_tree.rb', line 36

def parent_index
  @parent_index
end

#wire_pathObject (readonly)

Returns the value of attribute wire_path

Returns:

  • (Object)

    the current value of wire_path



36
37
38
# File 'lib/axn/internal/subfield_tree.rb', line 36

def wire_path
  @wire_path
end

Instance Method Details

#parent_nodeObject

The on:-target Node (the config's immediate parent in contract terms). A field name is a single wire key, so the leaf sits DIRECTLY under this node — it is also the leaf's wire parent, and its wire key is config.field.



40
# File 'lib/axn/internal/subfield_tree.rb', line 40

def parent_node = ancestors[parent_index].first