Class: Phlexi::Field::Structure::Node

Inherits:
Object
  • Object
show all
Defined in:
lib/phlexi/field/structure/node.rb

Overview

Superclass for Namespace and Field classes. Represents a node in the field tree structure.

Direct Known Subclasses

Builder, Namespace, NamespaceCollection

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(key, parent:) ⇒ Node

Initializes a new Node instance.

Parameters:

  • key (Symbol, String)

    The key for the node

  • parent (Node, nil)

    The parent node



17
18
19
20
# File 'lib/phlexi/field/structure/node.rb', line 17

def initialize(key, parent:)
  @key = :"#{key}"
  @parent = parent
end

Instance Attribute Details

#keySymbol (readonly)

The node’s key

Returns:

  • (Symbol)

    the current value of key



10
11
12
# File 'lib/phlexi/field/structure/node.rb', line 10

def key
  @key
end

#parentNode? (readonly)

The node’s parent in the tree structure

Returns:

  • (Node, nil)

    the current value of parent



10
11
12
# File 'lib/phlexi/field/structure/node.rb', line 10

def parent
  @parent
end

Instance Method Details

#inspectObject



22
23
24
# File 'lib/phlexi/field/structure/node.rb', line 22

def inspect
  "<#{self.class.name} key=#{key.inspect} object=#{object.inspect} parent=#{parent.inspect} />"
end