Module: Tree::InternalParentChildImplementation

Includes:
ChildrenProperty, ParentProperty
Included in:
InternalParentChildArrayImplementation
Defined in:
lib/modular_tree/implementations.rb

Instance Method Summary collapse

Methods included from ChildrenProperty

#children, #detach, #each_child

Methods included from ParentProperty

#parent, #parent=

Instance Method Details

#attach(child) ⇒ Object



242
243
244
245
# File 'lib/modular_tree/implementations.rb', line 242

def attach(child)
  super(child)
  child.send(:parent=, self)
end

#initialize(parent) ⇒ Object



237
238
239
240
# File 'lib/modular_tree/implementations.rb', line 237

def initialize(parent)
  super
  parent&.attach(self)
end