Returns list of ancestors, starting from parent until root.
subchild1.ancestors # => [child1, root]
# File lib/active_ldap/acts/tree.rb, line 22 def ancestors node, nodes = self, [] nodes << node = node.parent while node.parent nodes end
# File lib/active_ldap/acts/tree.rb, line 49 def parent if base == self.class.base nil else find(:first, :base => base, :scope => :base) end end
# File lib/active_ldap/acts/tree.rb, line 57 def parent=(entry) if entry.is_a?(String) or entry.is_a?(DN) base = entry elsif entry.respond_to?(:dn) base = entry.dn if entry.respond_to?(:clear_association_cache) entry.clear_association_cache end else message = _("parent must be an entry or parent DN: %s") % entry.inspect raise ArgumentError, message end destroy unless new_entry? self.dn = "#{dn_attribute}=#{id},#{base}" save end
Returns the root node of the tree.
# File lib/active_ldap/acts/tree.rb, line 29 def root node = self node = node.parent while node.parent node end
Generated with the Darkfish Rdoc Generator 2.