module OM::TreeNode

Attributes

ancestors[RW]

Public Instance Methods

add_child(child_mapper) click to toggle source

insert the given mapper into the current mappers children

# File lib/om/tree_node.rb, line 12
def add_child(child_mapper)
  child_mapper.ancestors << self
  @children[child_mapper.name.to_sym] = child_mapper    
end
parent() click to toggle source
# File lib/om/tree_node.rb, line 21
def parent
  ancestors.last
end
retrieve_child(child_name) click to toggle source
# File lib/om/tree_node.rb, line 17
def retrieve_child(child_name)
  child = @children.fetch(child_name, nil)
end
set_parent(parent_mapper) click to toggle source

insert the mapper into the given parent

# File lib/om/tree_node.rb, line 6
def set_parent(parent_mapper)
  parent_mapper.children[@name] = self
  @ancestors << parent_mapper
end