Module: OM::TreeNode
- Included in:
- XML::NamedTermProxy, XML::Term
- Defined in:
- lib/om/tree_node.rb
Instance Attribute Summary collapse
-
#ancestors ⇒ Object
Returns the value of attribute ancestors.
Instance Method Summary collapse
-
#add_child(child_mapper) ⇒ Object
insert the given mapper into the current mappers children.
- #parent ⇒ Object
- #retrieve_child(child_name) ⇒ Object
-
#set_parent(parent_mapper) ⇒ Object
insert the mapper into the given parent.
Instance Attribute Details
#ancestors ⇒ Object
Returns the value of attribute ancestors.
3 4 5 |
# File 'lib/om/tree_node.rb', line 3 def ancestors @ancestors end |
Instance Method Details
#add_child(child_mapper) ⇒ Object
insert the given mapper into the current mappers children
12 13 14 15 |
# 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 ⇒ Object
21 22 23 |
# File 'lib/om/tree_node.rb', line 21 def parent ancestors.last end |
#retrieve_child(child_name) ⇒ Object
17 18 19 |
# File 'lib/om/tree_node.rb', line 17 def retrieve_child(child_name) child = @children.fetch(child_name, nil) end |
#set_parent(parent_mapper) ⇒ Object
insert the mapper into the given parent
6 7 8 9 |
# File 'lib/om/tree_node.rb', line 6 def set_parent(parent_mapper) parent_mapper.children[@name] = self @ancestors << parent_mapper end |